freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] load glyph error


From: David Turner
Subject: Re: [Freetype] load glyph error
Date: Mon, 27 Aug 2001 11:04:16 +0200

Hello Brian,

  the error codes have been changed between 2.0.2 (the version
  of FT2 you're user has installed on its system) and 2.0.4,
  which is why "0x442" isn't defined anymore..

  (and it was a TrueType-specific thing at that time)

  I suggest asking your user to update its version of FreeType
  to see if it solves the problem. If not, let us know and we
  will look deeper into this problem..

Regards,

- David


Brian Stell a écrit :
> 
> I have a prototype integration of FreeType2 in the Mozilla browser.
> It works well on my Redhat 6.2 and Redhat 7.1 systems.
> 
> I have a user that is running Debian (with FreeType from a Debian
> SID) who is seeing the FT_Load_Glyph call fail but seeing the cache
> manager succeed in getting the glyph.
> 
> In the first phase the code directly opens all the fonts to
> generate a catalog. This works for me but FT_Load_Glyph fails for
> this user.
> 
> In the second phase the code accesses fonts using the cache
> manager and displays text. This works for both me and this
> user.
> 
> Here is the code in the first phase:
> 
>   sFreeTypeInitError = FT_Init_FreeType(&sFreeTypeLibrary);
>   if (sFreeTypeInitError) {
>     do not use freetype
>   ...
>   FT_Error error = FTC_Manager_New(sFreeTypeLibrary, 0, 0, 0,
>                       nsFreeTypeFaceRequester, 0, &sFTCacheManager);
>   NS_ASSERTION(error==0, "failed to create FreeType Cache manager");
>   error = FTC_Image_Cache_New(sFTCacheManager, &sImageCache);
>   NS_ASSERTION(error==0, "failed to create FreeType image cache");
>   ...
> 
>   // open the font
>   fterror = FT_New_Face(aFreeTypeLibrary, aFontFileName, 0, &face);
>   if ((fterror) || (!FT_IS_SCALABLE(face))) {
>     ignore this font
>   ...
>   tt_os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
>   if (!tt_os2) {
>     FONT_CATALOG_PRINTF(("unable to get OS2 table"));
>     ignore this font
>   ...
>   for (i=0; i<len; i++) { // len = 0x10000
>     glyph_index = FT_Get_Char_Index(face, (FT_ULong)i);
>     if (!glyph_index)
>       continue;
>     fterror = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
>     if (fterror) {
>         printf("i = %d, glyph_index=%d, fterror = %d, face = %p\n",
>                         i, glyph_index, fterror, face);
>       continue;
>     }
> 
> The FT_Load_Glyph returns a non-zero error:
> 
>     i = 33, glyph_index = 4, fterror = 1090, face = 0x836af38
>     i = 34, glyph_index = 5, fterror = 1090, face = 0x836af38
>     i = 35, glyph_index = 6, fterror = 1090, face = 0x836af38
>     i = 36, glyph_index = 7, fterror = 1090, face = 0x836af38
>     ...
> 
> The error code is decimal 1090 which is 0x442.
> 
> If I understand the error codes this means module 4 and error
> code 0x42.
> 
> But module 4 is CID not TrueType and there does not appear to
> be an error code 0x42.
> 
> Any thoughts?
> 
> The other font values seem okay:
> 
>     FontFileName=/usr/local/lib/ttffonts/formal-436.ttf
>     FamilyName=Formal436 BT
>     FaceIndex=0
>     StyleName=Regular
>     NumGlyphs=260
>     FaceFlags=0x00000259
>     StyleFlags=0x00000000
>     Weight=400
>     Width=5
>     CodePageRange1=0x00000000
>     CodePageRange2=0x00000000
>     VendorID=Bits
> 
> Here is information on the user's system:
> 
>     Debian sid
>     Linux terminus 2.4.9 #1 SMP Fri Aug 17 11:38:08 EDT 2001
>       i686 unknown
>     ii  libc6 2.2.4-1 GNU C Library: Shared libraries and
>       Timezone dat
>     ii  xlibs 4.1.0-2 X Window System client libraries
> 
>     ii  libfreetype6  2.0.2.20010514-1 FreeType 2 font engine,
>       shared library files.
>     ii  libfreetype6-dev 2.0.2.20010514-1 FreeType 2 font engine,
>       development files
> 
> Here is later bit of code that does the drawing:
> 
>   // get the glyph and draw it to a XImage
>   for (PRUint32 i=0; i<aLength; i++) {
>     glyph_index = FT_Get_Char_Index(face, (FT_ULong)aString[i]);
>     error = FTC_Image_Cache_Lookup(nsFreeType::sImageCache,
>                                    &mImageDesc, glyph_index, &glyph);
>     if (error) {
>       // draw an empty box for the missing character
>       ...
>       continue;
>     }
>     ...
>     // draw the glyph to a (local) XImage
>     FT_BitmapGlyph slot = (FT_BitmapGlyph)glyph;
>     (*nsFreeType::sBlitGlyph)(ximage, slot, pixel, xOff,
>                                  bbox.yMax-slot->top);
>     xOff += slot->root.advance.x>>16;
>   }
>   // send the XImage to the display
>   XPutImage(dpy, GDK_WINDOW_XWINDOW(aSurface->GetDrawable()),
>   ...
> 
> --
> Brian Stell
> mailto:address@hidden
> 
> _______________________________________________
> Freetype mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/freetype



reply via email to

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