Menu

Tree [8e15a4] master /
 History

HTTPS access


File Date Author Commit
 README 2009-08-02 suzuki toshiya suzuki toshiya [52c128] Add support for TTF output, 2007-07-29
 merge2ttcf.pl 2009-08-09 suzuki toshiya suzuki toshiya [8e15a4] $_ should not be qualified as my $_
 split_ttcf.pl 2009-08-02 suzuki toshiya suzuki toshiya [29dcde] Fix a stupid bug in TTC/TTF header check

Read Me

WHAT IS THIS?
=============
split_ttcf.pl & merge2ttcf.pl are originally written
by suzuki toshiya (mpsuzuki at Hiroshima Univ.).

split_ttcf.pl parses a TrueType directory of given
TTF or TTC file, and split each table into separated
files, with suffix ".sdat". If split_ttcf.pl receives
TTC file, the index number of included faces are added
to the suffiex. See example shown in later.

merge2ttcf.pl receives a list of TrueType table
files by arguments, and generate a TTF or TTC stream.
merge2ttcf.pl defines a face by the suffixes of
".sdat" files. The ".sdat" files with same suffixes
are recognized as a tables which should be included
in same face. So you should be careful to naming the
each ".sdat" file names. If the ".sdat" file list is
recognized as a list of files for only single face,
merge2ttcf.pl generates TTF stream. If the file list
is recognized as a list of multiple faces, merge2ttcf.pl
generates TTC stream.

If merge2ttcf.pl receives multiple tables with same
tag, same length and same TTF checksum, only the first
table is included in TTC. On the other hand, if
split_ttcf.pl receives a TTC including a TrueType
table shared by multiple faces, multiple ".sdat" files
are generated.

Please don't use this tools to modify non-free 
fonts. Most commercial fonts are licensed without
permission to modify. 


BUGS or REQUESTED FEATURE (2007/07/29)
======================================
* Not tested at all (suzuki toshiya).

* Merging multiple glyf tables into single glyf and
  fixing loca table of each faces. Also same feature
  for EBDT & EBLC is required.

USAGE (2007/07/28)
==================

1. splitting a TTF file
-----------------------

$ /path/to/split_ttf.pl \
	--output-prefix=sazanami-mincho \
	--input-ttf=/path/to/sazanami-mincho.ttf

  [...you will received debug messages]

$ ls -1
sazanami-mincho.EBDT.sdat
sazanami-mincho.EBLC.sdat
sazanami-mincho.GDEF.sdat
sazanami-mincho.GSUB.sdat
sazanami-mincho.OS_2.sdat
sazanami-mincho.cmap.sdat
sazanami-mincho.gasp.sdat
sazanami-mincho.glyf.sdat
sazanami-mincho.head.sdat
sazanami-mincho.hhea.sdat
sazanami-mincho.hmtx.sdat
sazanami-mincho.loca.sdat
sazanami-mincho.maxp.sdat
sazanami-mincho.name.sdat
sazanami-mincho.post.sdat

2. merge TTF tables into a TTC file
-----------------------------------

$ ls -1
sazanami-gothic.EBDT.sdat
sazanami-gothic.EBLC.sdat
sazanami-gothic.GDEF.sdat
sazanami-gothic.GSUB.sdat
sazanami-gothic.OS_2.sdat
sazanami-gothic.cmap.sdat
sazanami-gothic.gasp.sdat
sazanami-gothic.glyf.sdat
sazanami-gothic.head.sdat
sazanami-gothic.hhea.sdat
sazanami-gothic.hmtx.sdat
sazanami-gothic.loca.sdat
sazanami-gothic.maxp.sdat
sazanami-gothic.name.sdat
sazanami-gothic.post.sdat
sazanami-mincho.EBDT.sdat
sazanami-mincho.EBLC.sdat
sazanami-mincho.GDEF.sdat
sazanami-mincho.GSUB.sdat
sazanami-mincho.OS_2.sdat
sazanami-mincho.cmap.sdat
sazanami-mincho.gasp.sdat
sazanami-mincho.glyf.sdat
sazanami-mincho.head.sdat
sazanami-mincho.hhea.sdat
sazanami-mincho.hmtx.sdat
sazanami-mincho.loca.sdat
sazanami-mincho.maxp.sdat
sazanami-mincho.name.sdat
sazanami-mincho.post.sdat

$ /path/to/merge2ttc.pl \
	--output-ttc=sazanami.ttc \
	sazanami-*.sdat

  [...you will received debug messages]
 copy sazanami-gothic.EBDT.sdat @ 0x00000000
 copy sazanami-gothic.EBLC.sdat @ 0x002ae6ce
 copy sazanami-gothic.GDEF.sdat @ 0x003d8c46
 copy sazanami-gothic.GSUB.sdat @ 0x003d8c64
 copy sazanami-gothic.OS_2.sdat @ 0x003d93c4
 copy sazanami-gothic.cmap.sdat @ 0x003d941a
 copy sazanami-gothic.gasp.sdat @ 0x003e1c7c
 copy sazanami-gothic.glyf.sdat @ 0x003e1c8c
 copy sazanami-gothic.head.sdat @ 0x0073aaee
 copy sazanami-gothic.hhea.sdat @ 0x0073ab24
 copy sazanami-gothic.hmtx.sdat @ 0x0073ab48
 copy sazanami-gothic.loca.sdat @ 0x00747bf2
 copy sazanami-gothic.maxp.sdat @ 0x00755036
 copy sazanami-gothic.name.sdat @ 0x00755056
 copy sazanami-gothic.post.sdat @ 0x00755729
 copy sazanami-mincho.EBDT.sdat @ 0x00755749
 copy sazanami-mincho.EBLC.sdat @ 0x00a085dd
 copy sazanami-mincho.GDEF.sdat @ 0x00b36a4d
 copy sazanami-mincho.GSUB.sdat @ 0x00b36a6b
 copy sazanami-mincho.OS_2.sdat @ 0x00b36bcf
 copy sazanami-mincho.cmap.sdat @ 0x00b36c25
 ignore sazanami-mincho.gasp.sdat, reuse preceding table @ 0xffc1e384
 copy sazanami-mincho.glyf.sdat @ 0x00b3f367
 copy sazanami-mincho.head.sdat @ 0x01149003
 copy sazanami-mincho.hhea.sdat @ 0x01149039
 copy sazanami-mincho.hmtx.sdat @ 0x0114905d
 copy sazanami-mincho.loca.sdat @ 0x01157521
 copy sazanami-mincho.maxp.sdat @ 0x01165a81
 copy sazanami-mincho.name.sdat @ 0x01165aa1
 ignore sazanami-mincho.post.sdat, reuse preceding table @ 0xff8aa8d7

$ ftdump sazanami.ttc
There are 2 faces in this file.

----- Face number: 0 -----

font name entries
   family:     Sazanami Gothic
   style:      Gothic-Regular
   postscript: Sazanami-Gothic-Regular

font type entries
   FreeType driver: truetype
   sfnt wrapped:    yes
   type:            scalable, fixed size
   direction:       horizontal
   fixed width:     no
   glyph names:     no
   EM size:         1024
   global BBox:     (-52,-208):(1066,1019)
   ascent:          1019
   descent:         -208
   text height:     1227

fixed size
     0: height 10, width 4
        size 8.000, x_ppem 8.000, y_ppem 8.000
     1: height 11, width 5
        size 9.000, x_ppem 9.000, y_ppem 9.000
     2: height 12, width 5
        size 10.000, x_ppem 10.000, y_ppem 10.000
     3: height 13, width 6
        size 11.000, x_ppem 11.000, y_ppem 11.000
     4: height 14, width 6
        size 12.000, x_ppem 12.000, y_ppem 12.000
     5: height 16, width 7
        size 13.000, x_ppem 13.000, y_ppem 13.000
     6: height 17, width 7
        size 14.000, x_ppem 14.000, y_ppem 14.000
     7: height 18, width 8
        size 15.000, x_ppem 15.000, y_ppem 15.000
     8: height 19, width 8
        size 16.000, x_ppem 16.000, y_ppem 16.000
     9: height 20, width 9
        size 17.000, x_ppem 17.000, y_ppem 17.000
    10: height 22, width 9
        size 18.000, x_ppem 18.000, y_ppem 18.000
    11: height 23, width 10
        size 19.000, x_ppem 19.000, y_ppem 19.000
    12: height 24, width 10
        size 20.000, x_ppem 20.000, y_ppem 20.000
    13: height 25, width 11
        size 21.000, x_ppem 21.000, y_ppem 21.000

charmaps
   0: platform: 0, encoding: 3
   1: platform: 1, encoding: 0
   2: platform: 3, encoding: 1

----- Face number: 1 -----

font name entries
   family:     Sazanami Mincho
   style:      Mincho-Regular
   postscript: Sazanami-Mincho-Regular

font type entries
   FreeType driver: truetype
   sfnt wrapped:    yes
   type:            scalable, fixed size
   direction:       horizontal
   fixed width:     no
   glyph names:     no
   EM size:         1024
   global BBox:     (-52,-160):(1280,997)
   ascent:          997
   descent:         -160
   text height:     1157

fixed size
     0: height 9, width 4
        size 8.000, x_ppem 8.000, y_ppem 8.000
     1: height 10, width 5
        size 9.000, x_ppem 9.000, y_ppem 9.000
     2: height 11, width 5
        size 10.000, x_ppem 10.000, y_ppem 10.000
     3: height 12, width 6
        size 11.000, x_ppem 11.000, y_ppem 11.000
     4: height 14, width 6
        size 12.000, x_ppem 12.000, y_ppem 12.000
     5: height 15, width 7
        size 13.000, x_ppem 13.000, y_ppem 13.000
     6: height 16, width 7
        size 14.000, x_ppem 14.000, y_ppem 14.000
     7: height 17, width 8
        size 15.000, x_ppem 15.000, y_ppem 15.000
     8: height 18, width 8
        size 16.000, x_ppem 16.000, y_ppem 16.000
     9: height 19, width 9
        size 17.000, x_ppem 17.000, y_ppem 17.000
    10: height 20, width 9
        size 18.000, x_ppem 18.000, y_ppem 18.000
    11: height 21, width 10
        size 19.000, x_ppem 19.000, y_ppem 19.000
    12: height 23, width 10
        size 20.000, x_ppem 20.000, y_ppem 20.000
    13: height 24, width 11
        size 21.000, x_ppem 21.000, y_ppem 21.000

charmaps
   0: platform: 0, encoding: 3
   1: platform: 1, encoding: 0
   2: platform: 3, encoding: 1

3. Splitting TTC file
---------------------
$ /path/to/split_ttcf.pl \
	--output-prefix=sazanami \
	--input-ttf=/path/to/sazanami.ttc

  [...you will received debug messages]

$ ls -1
sazanami_0.EBDT.sdat
sazanami_0.EBLC.sdat
sazanami_0.GDEF.sdat
sazanami_0.GSUB.sdat
sazanami_0.OS_2.sdat
sazanami_0.cmap.sdat
sazanami_0.gasp.sdat
sazanami_0.glyf.sdat
sazanami_0.head.sdat
sazanami_0.hhea.sdat
sazanami_0.hmtx.sdat
sazanami_0.loca.sdat
sazanami_0.maxp.sdat
sazanami_0.name.sdat
sazanami_0.post.sdat
sazanami_1.EBDT.sdat
sazanami_1.EBLC.sdat
sazanami_1.GDEF.sdat
sazanami_1.GSUB.sdat
sazanami_1.OS_2.sdat
sazanami_1.cmap.sdat
sazanami_1.gasp.sdat
sazanami_1.glyf.sdat
sazanami_1.head.sdat
sazanami_1.hhea.sdat
sazanami_1.hmtx.sdat
sazanami_1.loca.sdat
sazanami_1.maxp.sdat
sazanami_1.name.sdat
sazanami_1.post.sdat

As you can see in example 2, gasp and post tables are
shared by the 1st and 2nd faces, but split_ttcf.pl
generates 2 ".sdat" files.

4. Merging tables into single TTF file
--------------------------------------

$ /path/to/merge2ttcf.pl \
	--output-file=sazanami.ttf \
	sazanami_0*.sdat

  [...you will received debug messages]

$ ftdump sazanami.ttf
There is 1 face in this file.

----- Face number: 0 -----

font name entries
   family:     Sazanami Gothic
   style:      Gothic-Regular
   postscript: Sazanami-Gothic-Regular

font type entries
   FreeType driver: truetype
   sfnt wrapped:    yes
   type:            scalable, fixed size
   direction:       horizontal
   fixed width:     no
   glyph names:     no
   EM size:         1024
   global BBox:     (-52,-208):(1066,1019)
   ascent:          1019
   descent:         -208
   text height:     1227

fixed size
     0: height 10, width 4
        size 8.000, x_ppem 8.000, y_ppem 8.000
     1: height 11, width 5
        size 9.000, x_ppem 9.000, y_ppem 9.000
     2: height 12, width 5
        size 10.000, x_ppem 10.000, y_ppem 10.000
     3: height 13, width 6
        size 11.000, x_ppem 11.000, y_ppem 11.000
     4: height 14, width 6
        size 12.000, x_ppem 12.000, y_ppem 12.000
     5: height 16, width 7
        size 13.000, x_ppem 13.000, y_ppem 13.000
     6: height 17, width 7
        size 14.000, x_ppem 14.000, y_ppem 14.000
     7: height 18, width 8
        size 15.000, x_ppem 15.000, y_ppem 15.000
     8: height 19, width 8
        size 16.000, x_ppem 16.000, y_ppem 16.000
     9: height 20, width 9
        size 17.000, x_ppem 17.000, y_ppem 17.000
    10: height 22, width 9
        size 18.000, x_ppem 18.000, y_ppem 18.000
    11: height 23, width 10
        size 19.000, x_ppem 19.000, y_ppem 19.000
    12: height 24, width 10
        size 20.000, x_ppem 20.000, y_ppem 20.000
    13: height 25, width 11
        size 21.000, x_ppem 21.000, y_ppem 21.000

charmaps
   0: platform: 0, encoding: 3
   1: platform: 1, encoding: 0
   2: platform: 3, encoding: 1
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.