The code modifications I mentioned below to FTSize::CharSize seem to be
working and we're using them now. Looks like the bug was causing all
fonts to be sized for 72dpi which made our text smaller than expected.
With the fix, they get sized correctly.
In order to be in compliance with the license, I'd like to submit the
code change to the project. Is my below Email to the list sufficient?
Or is there something else I need to do to submit this code mod for
consideration in the baseline code? I'll assume the below is
sufficient unless someone suggests otherwise.
On 1/19/2010 9:15 AM, Dave Calkins wrote:
I'm using FreeTypeGL to render system fonts in OpenGL using the below
code (running on Windows).
FTFont* pFont = new FTTextureFont(fontFile);
This worked very well for multiple fonts I initially tried. I then
tried "MS Sans Serif" ("C:\Windows\Fonts\SSERIFE.FON") initially with a
point size of 8.
When calling FaceSize, the error flag FNT_Err_Invalid_Pixel_Size was
set. I asked about this initially on the FreeType list and someone
suggested the problem was the default dpi of 72 was not correct for
I tried changing my call to FaceSize to be the below, which passed in
res = GetDeviceCaps(refDC,LOGPIXELSY);
When doing this, it appeared to me not to have any affect in that 72
was still being passed to FreeType. It looked to me like there was a
bug in FTSize::CharSize. See the below where I replaced the commented
out line with the one below it.
bool FTSize::CharSize(FT_Face* face, unsigned int
pointSize, unsigned int xRes, unsigned int yRes)
if(size != pointSize || xResolution != xRes || yResolution != yRes)
// err = FT_Set_Char_Size(*face, 0L, pointSize * 64,
err = FT_Set_Char_Size(*face, 0L, pointSize * 64, xRes, yRes);
ftFace = face;
size = pointSize;
xResolution = xRes;
yResolution = yRes;
ftSize = (*ftFace)->size;
Making this change resulted in the 96 getting passed through to
FreeType. Now the FaceSize "works", there's no error flagged.
However, when I try and call Advance to figure out the width of a text
string, it crashes.
What's odd is that this works fine with other fonts (Times New Roman,
Lucida Sans Unicode), but with "MS Sans Serif" its not working.
Any ideas? Suggestions?
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
Ftgl-devel mailing list