freetype
[Top][All Lists]
Advanced

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

[ft] Font broken or FreeType?


From: Peter Weilbacher
Subject: [ft] Font broken or FreeType?
Date: Thu, 30 Oct 2008 12:45:16 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b2pre) Gecko/20081029 SeaMonkey/2.0a2pre

I encountered a problem with FT_Load_Glyph() using the "Helvetica Italic"
font (HELVI.PFB) that is included with OS/2. It fails for one glyph (499
starting from 0) with error code 0xa0 ("opcode syntax error"). The short
program below demonstrates it. I can easily provide the font, if needed.

Now, to find out if it's the font that is broken or FreeType just stumbles
over a quirk in a correct font, I tried to verify the problem with FontForge.
Perhaps I don't know how to properly handle that program, but it doesn't
expose any problems. (Just that FontForge seems to sort the glyphs
differently, 499 is not the one that I am trying to load, the ones around
it have different names, too).

Thanks in advance for any hints!
   Peter.

---------------------- brokenHelvI_test.c -----------------------

// sample output for broken font:
// $ brokenHelvI_test.exe HELVI.PFB 499
// 1: error=0xa0 for HELVI.PFB glyph 499
// 2: error=0xa0 for HELVI.PFB glyph 499

#include "ft2build.h"
#include FT_FREETYPE_H
#include <stdio.h>

int main(int argc, char *argv[])
{
  FT_Library ftlib;
  FT_Init_FreeType(&ftlib);

  FT_Face face;
  FT_Error error = FT_New_Face(ftlib, argv[1], 0, &face);
  if (error) {
    printf("error=0x%x loading %s\n", error, argv[1]);
    FT_Done_FreeType(ftlib);
    return 1;
  }
  error = FT_Load_Glyph(face, atoi(argv[2]), FT_LOAD_NO_SCALE | 
FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM);
  if (error) {
    printf("1: error=0x%x for %s glyph %d\n", error, argv[1], atoi(argv[2]));
  }
  error = FT_Load_Glyph(face, atoi(argv[2]), FT_LOAD_DEFAULT);
  if (error) {
    printf("2: error=0x%x for %s glyph %d\n", error, argv[1], atoi(argv[2]));
  }
  FT_Done_Face(face);

  FT_Done_FreeType(ftlib);
  return 0;
}





reply via email to

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