Options

Open-source OpenType serializer and builder, otfcc

My OpenType dumper and builder reaches its first public beta.

Currently only TrueType-outlined font files are supported, while Clerk Ma is working on the CFF parser/builder. It can build a 24MB Chinese font within 6 seconds, while ttx takes 4 minutes.

Project homepage: https://github.com/caryll/otfcc
Releases: https://github.com/caryll/otfcc/releases

 ------ README ------

otfcc is an high-performance open-source C library and utility used for parsing and building OpenType font files.

Key features

  • Read an OpenType font, (TrueType is supported as well)
  • And dump its data into JSON.
  • Or parse a dump of an OpenType font,
  • And build an OpenType font according to it.

Usage

otfccdump : Dump an OpenType font file into JSON

otfccdump [OPTIONS] input.[otf|ttf|ttc]

 -h, --help              : Display this help message and exit.
 -v, --version           : Display version information and exit.
 -o <file>               : Set output file path to <file>.
 -n <n>, --ttc-index <n> : Use the <n>th subfont within the input font.
 --pretty                : Prettify the output JSON.
 --ugly                  : Force uglify the output JSON.
 --time                  : Time each substep.
 --ignore-glyph-order    : Do not export glyph order information.
 --ignore-hints          : Do not export hingint information.
 --add-bom               : Add BOM mark in the output. (This is default
                           on Windows when redirecting to another program.
                           Use --no-bom to turn it off.)

otfccbuild : Build an OpenType font file from JSON

otfccbuild [OPTIONS] input.json -o output.[ttf|otf]

 -h, --help                : Display this help message and exit.
 -v, --version             : Display version information and exit.
 -o <file>                 : Set output file path to <file>.
 --time                    : Time each substep.
 --ignore-glyph-order      : Ignore the glyph order information in the input.
 --ignore-hints            : Ignore the hinting information in the input.
 --keep-average-char-width : Keep the OS/2.xAvgCharWidth value from the input
                             instead of stating the average width of glyphs.
                             Useful when creating a monospaced font.
 --short-post              : Don't export glyph names in the result font. It
                             will reduce file size.
 --dummy-DSIG              : Include an empty DSIG table in the font. For
                             some Microsoft applications, a DSIG is required
                             to enable OpenType features.

Currently supported tables

  • head
  • hhea
  • maxp
  • OS/2
  • post
  • glyf and loca
  • hmtx
  • vhea
  • vmtx
  • fpgm
  • prep
  • cvt
  • gasp
  • GSUB
  • GPOS
  • GDEF

Comments

  • Options
    James PuckettJames Puckett Posts: 1,970
    Is the advantage of this over TTX that JSON might be easier to parse?
  • Options
    attarattar Posts: 209
    Is the advantage of this over TTX that JSON might be easier to parse?
    OP is writing a JS app and needed some C parser to have something that runs fast enough, from what I got.
  • Options
    Belleve InvisBelleve Invis Posts: 269
    edited April 2016
    Is the advantage of this over TTX that JSON might be easier to parse?
    Hmmm, yes, JSON is much simpler than XML, and integrating with other programs will be much easier. You can even use command line like this
    otfccdump from.ttf | whatever-program-manipulates-json | otfccbuild to.ttf
    to manipulate fonts.
  • Options
    Belleve InvisBelleve Invis Posts: 269
    edited August 2016
    Current table support set:

    • head
    • hhea
    • maxp
    • OS/2
    • post
    • glyf and loca
    • hmtx
    • vhea
    • vmtx
    • fpgm
    • prep
    • cvt&nbsp;
    • gasp
    • GSUB
    • GPOS
    • GDEF
    • CFF&nbsp;
    • BASE
Sign In or Register to comment.