Exemplo n.º 1
0
void HandleWord (void)
{
    char    wword[WORDLIMIT];
    int     wordindex;
    word    wwidth,wheight,newpos;


    //
    // copy the next word into [word]
    //
    wword[0] = *text++;
    wordindex = 1;
    while (*text>32)
    {
        wword[wordindex] = *text++;
        if (++wordindex == WORDLIMIT)
            Quit ("PageLayout: Word limit exceeded");
    }
    wword[wordindex] = 0;            // stick a null at end for C

    //
    // see if it fits on this line
    //
    VW_MeasurePropString (SmallFont, wword,wwidth,wheight);

    while (px+wwidth > (int) rightmargin[rowon])
    {
        NewLine ();
        if (layoutdone)
            return;         // overflowed page
    }

    //
    // print it
    //
    newpos = px+wwidth;
    if(fontcolor == 255 || textcolor != CR_UNTRANSLATED)
        VWB_DrawPropString (SmallFont, wword, textcolor);
    else
        VWB_DrawPropString (SmallFont, wword, CR_UNTRANSLATED, true, fontcolor);
    px = newpos;

    //
    // suck up any extra spaces
    //
    while (*text == ' ')
    {
        px += SPACEWIDTH;
        text++;
    }
}
Exemplo n.º 2
0
void HandleWord (void)
{
	char	word[WORDLIMIT];
	int	wordindex,
	      wwidth,
         wheight,
         newpos;


	//
	// copy the next word into [word]
	//
	word[0] = *text++;
	wordindex = 1;
	while (*text>32)
	{
		word[wordindex] = *text++;
		if (++wordindex == WORDLIMIT)
			Error ("PageLayout: Word limit exceeded");
	}
	word[wordindex] = 0;		// stick a null at end for C

	//
	// see if it fits on this line
	//
	VW_MeasurePropString (word, &wwidth, &wheight);

	while (px+wwidth > rightmargin[rowon])
	{
		NewLine ();
		if (layoutdone)
			return;		// overflowed page
	}

	//
	// print it
	//
	newpos = px+wwidth;
	VWB_DrawPropString (word);
	px = newpos;

	//
	// suck up any extra spaces
	//
	while (*text == ' ')
	{
		px += SPACEWIDTH;
		text++;
	}
}
Exemplo n.º 3
0
void DrawMultiLineText(const FString str, FFont *font, EColorRange color, ETSAlignment align, ETSAnchor anchor)
{
    int oldpa = pa;
    pa = anchor;

    const int basepx = px;
    long pos = -1, oldpos;
    do
    {
        oldpos = pos+1;
        pos = str.IndexOf('\n', oldpos);
        const FString line = str.Mid(oldpos, pos - oldpos);

        word width, height;
        VW_MeasurePropString(font, line, width, height);

        switch(align)
        {
        default:
            px = basepx;
            break;
        case TS_Right:
            px = basepx - width;
            break;
        case TS_Center:
            px = basepx - width/2;
            break;
        }

        VWB_DrawPropString(font, line, color);

        py += font->GetHeight();
    }
    while(pos != -1);

    pa = oldpa;
}