View Single Post
Old 01-13-2009, 11:29 PM   #120
bvesco
Human being with feelings
 
bvesco's Avatar
 
Join Date: Jun 2007
Posts: 125
Default Adventures in typeface...

I have been playing with this stuff and here's where we are at.

IGraphicsWin.cpp has the function body for

Code:
bool IGraphicsWin::DrawIText(IText* pText, char* str, IRECT* pR)
where around line 654 we see the conditional

Code:
    if (!mFontActive) {
        int h = pText->mSize;
        int esc = 10 * pText->mOrientation;
        int wt = (pText->mStyle == IText::kStyleBold ? FW_BOLD : 0);
        int it = (pText->mStyle == IText::kStyleItalic ? 1 : 0);
        HFONT font = CreateFont(h, 0, esc, esc, wt, it, 0, 0, 0, 0, 0, 0, 0, pText->mFont);
        SelectObject(pDC, font);  // leak?
        SetBkMode(pDC, TRANSPARENT);
        mFontActive = true;
        setColor = true;
    }
which is what restricts the size and weight from being set more than once (among other things). Perhaps this is done because the font is created every time the function is called. This is assuming CreateFont does not cache the font, I don't know much GDI so I am not sure of that one. For giggles I removed the (!mFontActive) check. I was now able to change font size any time I want, but not font weight. This puzzled me and led to playing around with line 657 until I ended up with

Code:
int wt = (pText->mStyle == IText::kStyleBold ? FW_EXTRABOLD: FW_EXTRABOLD);
which you would *think* means that all your text would always be extra bold no matter what you told it. Alas, such is not the case. I am unable to get any font weight other than the default. I'm going to dig into GDI and see if I can turn anything up. In the meantime, any other ideas? I'd really like to be able to bold some text
__________________
Audio tutorials and articles: http://www.benvesco.com/tonemonster/
My VST plugins: http://www.vescofx.com/
bvesco is offline   Reply With Quote