Skip to main content
Known Participant
August 8, 2013
Question

GlyphID reverse lookup to get Unicode characters

  • August 8, 2013
  • 1 reply
  • 1210 views

In my plug-in I have a GlyphID extracted from an IPMFont* but the glyph does not have a unicode value because it is a ligature, a combination of many unicode characters. Is there a way I can query the IPMFont* object to find out what unicode characters need to be used to convert to this ligature. In a TrueType font this information would be held in the 'GSUB' (Glyph SUBstitution) table.

a simple example of this would be:

'f' + 'f' + 'i' = 'ffi'

'1' + '/' + '2' = '½'

So the glyphID I have would be the 'ffi' or the '½' glyph and I need to find out the 3 unicode characters which, when used in combination, would cause that glyph to be used.

This is then extended to Arabic and Hindi fonts where the Ligatures are highly important in drawing the script correctly.

Using Utils<IGlyphUtils>->GlyphToCharacter (font, glyph, &userAreaChar) does not work as the glyph has no Unicode character representation so the function just returns 0.

Likewise Utils<IGlyphUtils>->GetUnicodeForGlyphID (font, glyph) gives the same result

This topic has been closed for replies.

1 reply

Legend
August 8, 2013

IGlyphUtils.h, may be?

P.

Known Participant
August 8, 2013

IGlyphUtils.h might be useful but I have yet to discover a routine that gives me the information I need.

Do I have to use glyphUtils->GetOTFAttribute and iterate through it to find which combination of unicode characters result in a particular glyphID? And what parameters should I use for GetOTFAttribute to get the ligature table?

Known Participant
August 8, 2013

Does anyone know how I can get to the 'GSUB' OpenType table from an IPMFont* object? I am going to have to assume that I will have to parse the GSUB table of the OpenType font myself to work out how to do Ligature substitution. Luckily there is good documentation at http://partners.adobe.com/public/developer/opentype/index_table_formats1.html