[Top][All Lists]

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

[Devel] (no subject)

From: Sander van der Wal
Subject: [Devel] (no subject)
Date: Tue, 29 May 2001 20:51:30 +0200

>I am trying to render pure CFF fonts that are embedded
within PDF files.  I have been able to get other font
types working, but there is a problem with pure CFF fonts.

>Basically, the FT_Get_Char_Index() method does not work
for pure CFF fonts.  It always returns zero because there
is no character map setup.  This means that I currently
have no way of mapping from a character code to a glyph
index.  Note that the method does work for OpenType CFF
fonts.  It's just the pure CFF that are a problem.

>I see from the list archives that others have used FT
for PDF rendering before.  If you have any suggestions
on the best way to obtain the correct mapping, or if
you have modified versions of the CFF code, I would be
most grateful.

I use this code snippet to build a table to map character codes to
glyph indices:

first I turn a glyph_index into the character name and then the
character name is turned into the character code.

  for (register int glyph_index = 0; glyph_index < face->num_glyphs;
glyph_index++) {
      FT_String name[128];
      /* get name from glyph_index */
      if (FT_Get_Glyph_Name(face, glyph_index, &name, 128) ==
FT_Err_Ok) {
        register int code = getCharCode(name); /* translate name into
charcode */
        if (code >= 0) {
          iCMap[code] = glyph_index;

/* now iCMap can be used to turn a code into a glyph_index */

Sander van der Wal

reply via email to

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