prawnpdf / ttfunk

Font Metrics Parser for Prawn
http://prawnpdf.org
Other
125 stars 75 forks source link

Kerning classes #44

Open louisatome opened 7 years ago

louisatome commented 7 years ago

I have a font file (JosefinSansStd-Light) with kerning information stored with classes to group some characters together. I can't find how to retrieve the groups informations with ttfunk. Any idea?

gettalong commented 7 years ago

The file is probably using kerning information stored in the OpenType table GPOS. This table is not yet supported by ttfunk, it just supports the TrueType kern table.

louisatome commented 7 years ago

OK thank you for the information. Is there any plan to support GPOS in the future?

pointlessone commented 7 years ago

Not quite. We do not have any planned new features (including this one) but we gladly accept contributions.

Please also note that at the moment TTFunk doe not support OTF at all. In order for any OTF-specific to be supported we first need that support to be implemented.

louisatome commented 7 years ago

Do you have examples of fonts that don't use GPOS kerning (and free to use) because I can't find any.

gettalong commented 7 years ago

Yes, GNU FreeFont for example (they use GPOS but also kern):

$ ttfdump -t head /usr/share/fonts/truetype/freefont/FreeSerif.ttf
True Type Font File Dumper: v 0.5.5
Copyright 1996-1998 ollie@ms1.hinet.net
Dumping File:/usr/share/fonts/truetype/freefont/FreeSerif.ttf

Offset Table
------------
         sfnt version:           1.0
         number of tables: 19
   0. 'FFTM' - checksum = 0x5be2c7ce, offset = 0x00326888, len =        28
   1. 'GDEF' - checksum = 0xc2d7cd84, offset = 0x0030c774, len =      2212
   2. 'GPOS' - checksum = 0x4a423be7, offset = 0x00316b30, len =     64854
   3. 'GSUB' - checksum = 0x95200c0b, offset = 0x0030d018, len =     39702
   4. 'OS/2' - checksum = 0x3b9eaee8, offset = 0x000001b8, len =        96
   5. 'cmap' - checksum = 0x50315cdb, offset = 0x0000a6c0, len =      6822
   6. 'cvt ' - checksum = 0x0b090bb3, offset = 0x0000c530, len =       144
   7. 'fpgm' - checksum = 0x0fb42fa7, offset = 0x0000c168, len =       613
   8. 'gasp' - checksum = 0x001d0009, offset = 0x0030c764, len =        16
   9. 'glyf' - checksum = 0x00190c1f, offset = 0x00016a6c, len =   2671716
  10. 'head' - checksum = 0x0519ae09, offset = 0x0000013c, len =        54
  11. 'hhea' - checksum = 0x07632c50, offset = 0x00000174, len =        36
  12. 'hmtx' - checksum = 0x923c5fd4, offset = 0x00000218, len =     42152
  13. 'kern' - checksum = 0xfdb78a8e, offset = 0x002a2ed0, len =    296714
  14. 'loca' - checksum = 0xad76e170, offset = 0x0000c5c0, len =     42156
  15. 'maxp' - checksum = 0x2ad010cf, offset = 0x00000198, len =        32
  16. 'name' - checksum = 0x47a92ca1, offset = 0x002eb5dc, len =      5743
  17. 'post' - checksum = 0xb61a739b, offset = 0x002ecc4c, len =    129813
  18. 'prep' - checksum = 0x8a611a4e, offset = 0x0000c3d0, len =       349

'head' Table - Font Header
--------------------------
         'head' version:         1.0
         fontReversion:          412.14592
         checkSumAdjustment:     0x37118f1e
         magicNumber:            0x5f0f3cf5
         flags:                  0x029f
         unitsPerEm:             1000
         created:                0x00000000cf2a98da
         modified:               0x00000000cf2a98da
         xMin:                   -879
         yMin:                   -551
         xMax:                   1767
         yMax:                   936
         macStyle bits:          0x0000
         lowestRecPPEM:          8
         fontDirectionHint:      0
         indexToLocFormat:       1
         glyphDataFormat:        0