[Fontconfig] fontconfig/freetype: resolving glyph index from another font when base font does not contain particular glyph

mpsuzuki at hiroshima-u.ac.jp mpsuzuki at hiroshima-u.ac.jp
Fri Aug 27 22:24:54 PDT 2010


Hi,

On Fri, 27 Aug 2010 11:26:13 -0400
"Derek Leach" <DLeach at qnx.com> wrote:
>I have fontconfig and freetype installed, and "working" for rendering
>"base" fonts, i.e. the family name is resolved properly, like Arial, and
>if the glyph is contained within that font, all the rendering proceeds.
>
>Now, I need to figure out what is necessary to "properly" implement
>glyph fallback ...
>
>1)       What API calls do I use to request fontconfig, given a glyph
>index, or character code, to find the font which contains the glyph I
>need?

To seach a font by fontconfig, the "pattern" object
should be created and passed to fontconfig.
To check the existence of valid glyph for a specified
character code point(s), the query process would be
following:

1) create a FcCharSet including target character
  1-a) create an empty FcCharSet by FcCharSetCreate()
  1-b) add the target characters to the FcCharset by FcCharSetAddChar()
2) create a FcPattern including FcCharSet that we created
  2-a) create an empty FcPattern by FcPatternCreate()
  2-b) add the FcCharSet to FcPattern by FcPatternAddCharSet()
3) lookup the fonts matching with the pattern by FcFontMatch()
4) finalize FcPattern & FcCharSet after the query.
  
I'm afraid fontconfig can check the existence of
valid glyph for specified character code, but cannot
answer for specified glyph index.

Checking the source freetype/src/fcfreetype.c,
the glyph index in FcFreeTypeCharSetAndSpacingForSize()
is not exported to out of the function.
Also, fontconfig.h defines FcCharSet structure,
but I cannot find something like FcGlyphSet.
I don't find a fontconfig function taking a glyph
index in its argument.

It seems that fontconfig can handle the database
of the glyph names, but I have no experience.

>2)       I know fontconfig contains a map of the glyph indices within
>the font,

Oh, I didn't know. Which data structure has the
map of glyph index?

Regards,
mpsuzuki


More information about the Fontconfig mailing list