All Projects → gfngfn → otfed

gfngfn / otfed

Licence: other
An OpenType font format encoder & decoder written in OCaml

Programming Languages

ocaml
1615 projects
Standard ML
205 projects

Projects that are alternatives of or similar to otfed

rmarsh
Ruby Marshal 4.8 encoder/decoder in Golang. Why? Who knows.
Stars: ✭ 15 (+0%)
Mutual labels:  encoder, decoder
logfmt
Package logfmt marshals and unmarshals logfmt messages.
Stars: ✭ 156 (+940%)
Mutual labels:  encoder, decoder
Tehreer-Android
Standalone text engine for Android aimed to be free from platform limitations
Stars: ✭ 61 (+306.67%)
Mutual labels:  fonts, opentype
Awesome Typography
✏︎ Curated list about digital typography 🔥
Stars: ✭ 947 (+6213.33%)
Mutual labels:  fonts, opentype
png
🖼A full-featured PNG decoder and encoder.
Stars: ✭ 64 (+326.67%)
Mutual labels:  encoder, decoder
Harfbuzz
HarfBuzz text shaping engine
Stars: ✭ 2,206 (+14606.67%)
Mutual labels:  fonts, opentype
urlpack
Pure JavaScript toolkit for data URLs (MessagePack, Base58 and Base62)
Stars: ✭ 51 (+240%)
Mutual labels:  encoder, decoder
variable-font-collection-test
Variable Font Collection Test
Stars: ✭ 26 (+73.33%)
Mutual labels:  fonts, opentype
png pong
A pure Rust PNG image decoder and encoder based on lodepng.
Stars: ✭ 21 (+40%)
Mutual labels:  encoder, decoder
bytecodec
A tiny Rust framework for implementing encoders/decoders of byte-oriented protocols
Stars: ✭ 21 (+40%)
Mutual labels:  encoder, decoder
text-rendering-tests
Unicode’s test suite for text rendering engines
Stars: ✭ 135 (+800%)
Mutual labels:  fonts, opentype
online-ethereum-abi-encoder-decoder
A quick online tool to abi-encode and abi-decode constructor arguments used in ethereum's solidity. https://adibas03.github.io/online-ethereum-abi-encoder-decoder/
Stars: ✭ 37 (+146.67%)
Mutual labels:  encoder, decoder
bitsnpicas
Bits'N'Picas - Bitmap & Emoji Font Creation & Conversion Tools
Stars: ✭ 171 (+1040%)
Mutual labels:  fonts, opentype
BatchEncoder
BatchEncoder is an audio files conversion software.
Stars: ✭ 145 (+866.67%)
Mutual labels:  encoder, decoder
Tehreer-Cocoa
Standalone text engine for iOS
Stars: ✭ 31 (+106.67%)
Mutual labels:  fonts, opentype
sms
A Go library for encoding and decoding SMSs
Stars: ✭ 37 (+146.67%)
Mutual labels:  encoder, decoder
Codablecsv
Read and write CSV files row-by-row or through Swift's Codable interface.
Stars: ✭ 214 (+1326.67%)
Mutual labels:  encoder, decoder
Enmime
MIME mail encoding and decoding package for Go
Stars: ✭ 246 (+1540%)
Mutual labels:  encoder, decoder
fdiff
An OpenType table diff tool for fonts. Based on the fontTools TTX format.
Stars: ✭ 33 (+120%)
Mutual labels:  fonts, opentype
keystore-go
A Go (golang) implementation of Java KeyStore encoder/decoder
Stars: ✭ 119 (+693.33%)
Mutual labels:  encoder, decoder

otfed: OpenType Font Format Encoder & Decoder

This library is intended to be a reformulation and extension of otfm.

See also:

Note

Some unit tests use data extracted from the following fonts:

How to install

Under the condition that opam (a package manager for OCaml, Coq, etc.) is installed, invoke the following commands:

$ cd <your-workspace>
$ git clone https://github.com/gfngfn/otfed
$ cd otfed
$ opam pin add otfed .

Probably the last command above will ask you whether to install otfed. Then answer y.

If not, invoking the following command will do:

$ opam install otfed

Usage of an example CLI otfedcli

$ dune exec otfedcli <path/to/font-file> <commands>

<commands> ::= [<command>]*

<command> ::=
  | tables                             # Prints all the tags of tables contained in the font.
  | cmap                               # Prints all the Unicode-aware `cmap` subtables.
  | cmap_word "<arbitrary-utf8-text>"  # Consults `cmap` subtables for each character in the given text.
  | head                               # Prints the contents of `head` table.
  | hhea                               # Prints the contents of `hhea` table.
  | maxp                               # Prints the contents of `maxp` table.
  | hmtx <glyph-id>                    # Consults the `hmtx` table by the glyph of ID <glyph-id>.
  | glyf <glyph-id> <output-svg-file>  # Outputs the glyph of ID <glyph-id> that has TrueType outlines.
  | cff <glyph-id> <output-svg-file>   # Outputs the glyph of ID <glyph-id> that has CFF outlines.
  | cff_lex <glyph-id>                 # Prints the tokenized CharString of the glyph of ID <glyph-id>.
  | cff_top                            # Prints the Top DICT in the `CFF␣` table.
  | charset <glyph-id>                 # Prints the name of the glyph by consulting the charset in `CFF␣`.
  | gsub <script> <langsys> <feature>  # Prints the contents of `GSUB` subtables.
  | gpos <script> <langsys> <feature>  # Prints the contents of `GPOS` subtables.
  | subset <glyph-ids> <output-ttf>    # Makes a subset font by using given glyph IDs.

<glyph-ids> ::= (comma-separated glyph IDs where no space is allowed around commas)

Example usage

Consults cmap subtables by Unicode code points:

$ dune exec otfedcli input/ipaexm.ttf cmap_word "田中太郎"
* subtable (platform: 0, encoding: 3)
  - U+7530 --> 2900
  - U+4E2D --> 2746
  - U+592A --> 2614
  - U+90CE --> 3830
* subtable (platform: 3, encoding: 1)
  - U+7530 --> 2900
  - U+4E2D --> 2746
  - U+592A --> 2614
  - U+90CE --> 3830
* subtable (platform: 3, encoding: 10)
  - U+7530 --> 2900
  - U+4E2D --> 2746
  - U+592A --> 2614
  - U+90CE --> 3830

Prints all of the Unicode-aware cmap subtables in IPAex Mincho (please be careful of large outputs on stdout):

$ dune exec otfedcli input/ipaexm.ttf cmap
(omitted)

Outputs the glyph of ID 1000 in IPAex Mincho as an SVG file:

$ dune exec otfedcli input/ipaexm.ttf glyf 1000 output/ipaexm1000.svg
(omitted)

Outputs the glyph of ID 50 in Computer Modern Typewriter Italic as an SVG file:

$ dune exec otfedcli input/cmunit.otf cff 50 output/cmunit1000.svg
(omitted)

Outputs the subset of Junicode which contains .notdef, “Q”, and “f” only:

$ dune exec otfedcli input/Junicode.ttf subset 0,113,302 output/Junicode-subset.ttf

Status

  • v: done
  • o: no automated test has been given, but seems working correctly for many inputs.
Tables Encoding operations Decoding operations
SupportedTestedSupportedTested
Required cmapv (Format 12 only)v (Format 12 only)v (Format 4, 12, and 13 only)v (Format 4 and 12 only)
headvvvv
hheavvvv
hmtxvvvv
maxpvvvv
namevvvv
OS/2vv (version 2 only)vv (version 2 only)
postvvvv
TTF cvt␣----
fpgm----
glyfvvvv
locavv (short only)vv (long only)
prep----
gasp----
CFF CFF␣vovv
CFF2----
VORG----
SVG SVG␣----
Optional DSIG----
kern--v (Format 0 only)o
vhea----
vmtx----
Advanced BASE----
GDEF----
GPOS--v (LookupType 1, 2, 4, 5, 6, and 9 only)o
GSUB--v (LookupType 1, 2, and 4 only)o
JSTF----
MATH--vo

How to develop

Assumes that Dune (≥2.7) is installed.

How to build

$ dune build

How to run tests

$ dune test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].