Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#8 How to get list of unicodes of all glyphs in font

None
closed
nobody
None
5
2013-12-10
2011-08-16
Pander
No

Hi all,

What is the best way to get a list of unicodes of all glyphs of a font.

I have a collection of font files and according to the name records they support:
platformID=0 platEndID= 0langID=0x0
platformID=1 platEndID=0 langID=0x0
platformID=3 platEndID=1 langID=0x409
or
platformID=1 platEndID=0 langID=0x0
platformID=3 platEndID=1 langID=0x409

So I figured that 3, 1, 0x409 is they way to go. Is this correct or do I need to have a more smart approach?

These files have cmap_format_4 elements for:
platformID=0 platEndID=0 language=0
platformID=3 platEndID=1 language=0
or
platformID=0 platEndID=3 language=0
platformID=3 platEndID=1 language=0

So I guess 3, 1, 0 is they way to go and from that I can read all the code and name entries.

Is the above correct? Should I also concern mysef with cmap_format_4 elements elements?

Thanks,

Pander

Discussion

  • set(sum((t.cmap.keys() for t in font['cmap'].tables if t.platformID==3 and t.platEncID in [1,10]), []))

     
  • Paul Wise
    Paul Wise
    2013-12-10

    • status: open --> closed
    • Group: -->
     
  • Paul Wise
    Paul Wise
    2013-12-10

    Thanks for the answer Behdad, closing.