Just wanted to follow up on this issue for reference purposes.

The problem described below was a result of the fact that the "MS Sans Serif" ("c:\windows\fonts\sserife.fon") font is not a scalable font.  It only exists at a discrete set of point sizes.  If you run the ftdump tool (one of the FreeType demo apps) on the font file, you'll see the list of discrete point sizes.  If you pick one of those (taking into account DPI) then it'll work.  If you pick any other size, it'll either fail with an "invalid pixel size" error, or in some cases succeed but render garbage (could be an FTGL issue, not sure).

According to the FreeType mailing list, FreeType does not support scaling non-scalable fonts, and so this limitation would be expected when using FTGL as well.

Our solution to this is two-fold.

1) We detect a non-scalable font (we call direct to FreeType and load the face, and then use the FT_IS_SCALABLE macro, then free it before loading it with FTGL).  When detected, we use a fallback font instead which we know to be scalable.

2) We modify our use of the font selection dialog in windows by passing in the CF_SCALABLEONLY flag.  This way the user is only ever presented with scalable fonts to choose from.

For this specific font, another font exists called "Microsoft Sans Serif" which appears to be a newer scalable version of "MS Sans Serif" so if you want this specific font it looks like you can use the scalable one instead.



On 1/27/2010 9:38 PM, Dave Calkins wrote:
I did some more testing with this and found more strangeness with this particular font.  Below I mentioned that attempting to size "MS Sans Serif" to 10pts at 96dpi resulted in an error being set (Invalid_Pixel_Size).

I tried using 8pts instead.  With 8pts, no error code is set when calling FaceSize, however, when rendering the font, all I get is garbage on the screen.

Any idea whats going on with "MS Sans Serif"?

On 1/27/2010 10:51 AM, Dave Calkins wrote:
I'm using FreeTypeGL on Windows 7.  It seems to be working fine for a number of fonts.  I tried using "MS Sans Serif" and there appear to be problems.

This face name maps to the "C:\Windows\Fonts\SSERIFE.FON" font file.  I'm calling the below to load the font.

FTFont* pFont = new FTTextureFont(fontFile);

After the above, pFont->Error() == 0.

I then get the output device resolution with the below which turns out to be 96dpi.

int resY = pMainWndDC->GetDeviceCaps(LOGPIXELSY);

I then attempt to size the font with the below call.  I'm calling this with pointSize == 10, though the problem happens for other points sizes as well.

pFont->FaceSize(pointSize,resY);

After calling FaceSize, pFont->Error() == 0x17 which is defined as the below in fterrdef.h.

  FT_ERRORDEF_( Invalid_Pixel_Size,                          0x17, \
                "invalid pixel size" )

Any idea what the problem is with this font?  I'm able to use it in WordPad, for example, at 10 points on the same output device (96dpi) with no problems.

------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com
_______________________________________________ Ftgl-devel mailing list Ftgl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ftgl-devel
------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com
_______________________________________________ Ftgl-devel mailing list Ftgl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ftgl-devel