freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] font size error


From: Dave Calkins
Subject: [ft] font size error
Date: Mon, 18 Jan 2010 16:49:41 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0

We're using FreeTypeGL to load and display text using OpenGL (native Win32 C++ MFC code built with VS2005), which is in turn calling FreeType to load and size a font. When we attempt to size it, an error is returned. In tracing into the source, the error condition is occurring in a FreeType function.

When using other font family and point size choices it works fine. For this particular combination of font family and point size, though, the sizing of the font fails with an error FNT_Err_Invalid_Pixel_Size. We're requesting "MS Sans Serif" with a point size of 8. We've also tried a couple other sizes for this same font family with no luck.

Any ideas?  Is the problem that its a ".fon" file?

I've provided the details as to where the error is happening below in case you're curious.

================================

1) We're looking up the font file in the Windows registry, which yields "C:\Windows\Fonts\SSERIFE.FON".

2) We're loading the font via the below FreeTypeGL object instantiation (where fe.font is a pointer to an FTTextureFont object).

    fe.font = new FTTextureFont(fontFile);

3) After calling the above, fe.font->Error() == 0.

4) We then attempt to size the font with the below call.

    fe.font->FaceSize(pointSize);

5) This eventually calls FT_Set_Char_Size(face = <ptr>,char_width = 0,char_height = 512,horz_resolution = 0,vert_resolution = 0). This function ends up setting the char_width and char_height to both be 512 and both resolutions to be 72. It then calls FT_Request_Size.

6) The FT_Request_Size call ends up making the below call.

    if ( clazz->request_size )
      return clazz->request_size( face->size, req );

7) Inside the request_size call, the below case block is hit and the condition evals to false which leaves the error as FNT_Err_Invalid_Pixel_Size.

    switch ( req->type )
    {
    case FT_SIZE_REQUEST_TYPE_NOMINAL:
      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
        error = FNT_Err_Ok;
      break;

It looks like its failing a check concerning which sizes are available in the font. I am able, though, to use an 8pt MS Sans Serif font in, say, WordPad.









reply via email to

[Prev in Thread] Current Thread [Next in Thread]