otfed : OpenType Font Format Encoder & Decoder otfedcli Sob a condição de que opam (um gerenciador de pacotes para OCAML, COQ, etc.) está instalado, invocar os seguintes comandos:
$ cd < your-workspace >
$ git clone https://github.com/gfngfn/otfed
$ cd otfed
$ opam pin add otfed . Provavelmente, o último comando acima perguntará se a instalação otfed . Então responda y .
Caso contrário, invocar o seguinte comando fará:
$ opam install otfed otfedcli $ dune exec otfedcli < path/to/font-file > < command > ... < 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.
| vhea # Prints the contents of `vhea` table.
| maxp # Prints the contents of `maxp` table.
| hmtx <glyph-id> # Consults the `hmtx` table by the glyph of ID <glyph-id>.
| vmtx <glyph-id> # Consults the `vmtx` 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) Consulte os subtáveis cmap por 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 Imprime todos os subtáveis cmap com reconhecimento de unicode no ipaex mincho (tenha cuidado com grandes saídas no stdout):
$ dune exec otfedcli input/ipaexm.ttf cmap
(omitted)Produz o glifo do ID 1000 no mincho ipaex como um arquivo SVG:
$ dune exec otfedcli input/ipaexm.ttf glyf 1000 output/ipaexm1000.svg
(omitted)Produza o glifo do ID 50 na máquina de escrever moderna de computador itálico como um arquivo SVG:
$ dune exec otfedcli input/cmunit.otf cff 50 output/cmunit1000.svg
(omitted) Produz o subconjunto de Junicode que contém .notdef , "Q" e "F" apenas:
$ dune exec otfedcli input/Junicode.ttf subset 0,113,302 output/Junicode-subset.ttf | Mesas | Operações de codificação | Operações de decodificação | ||||
|---|---|---|---|---|---|---|
| Suportado | Testado | Suportado | Testado | |||
| Obrigatório | cmap | Formato 0 | - | - | - | - |
| Formato 2 | - | - | - | - | ||
| Formato 4 | - | - | V | V | ||
| Formato 6 | - | - | - | - | ||
| Formato 8 | - | - | - | - | ||
| Formato 10 | - | - | - | - | ||
| Formato 12 | V | V | V | V | ||
| Formato 13 | - | - | V | V | ||
| Formato 14 | V | V | V | V | ||
| cabeça | V | V | V | V | ||
| Hhea | V | V | V | V | ||
| hmtx | V | V | V | V | ||
| Maxp | V | V | V | V | ||
| nome | V | V | V | V | ||
| OS/2 | ver. 0 | V | o | V | o | |
| ver. 1 | V | o | V | o | ||
| ver. 2 | V | V | V | V | ||
| ver. 3, 4 e 5 | V | o | V | o | ||
| publicar | V | V | V | V | ||
| Ttf | cvt␣ | - | - | - | - | |
| FPGM | - | - | - | - | ||
| Glyf | V | V | V | V | ||
| loca | curto | V | V | V | o | |
| longo | V | o | V | V | ||
| preparação | - | - | - | - | ||
| suspiro | - | - | - | - | ||
| Cff | Cff␣ | V | o | V | V | |
| Cff2 | - | - | - | - | ||
| Vorg | - | - | - | - | ||
| Svg | Svg␣ | - | - | - | - | |
| Opcional | Dsig | - | - | - | - | |
| Kern | Formato 0 | - | - | V | V | |
| outro | - | - | - | - | ||
| Vhea | ver. 1.0 | V | V | V | V | |
| ver. 1.1 | V | x | V | x | ||
| vmtx | V | V | V | V | ||
| Avançado | BASE | - | - | - | - | |
| GDEF | - | - | - | - | ||
| GPOs | Lookuptype 1 | - | - | V | o | |
| LookUptype 2 | - | - | V | o | ||
| LookUptype 3 | - | - | V | x | ||
| Lookuptype 4 | - | - | V | o | ||
| LookUptype 5 | - | - | V | o | ||
| LookUptype 6 | - | - | V | o | ||
| Lookuptype 7 | - | - | - | - | ||
| Lookuptype 8 | - | - | - | - | ||
| Lookuptype 9 | - | - | V | o | ||
| Gsub | Lookuptype 1 | - | - | V | o | |
| LookUptype 2 | - | - | V | o | ||
| LookUptype 3 | - | - | - | - | ||
| Lookuptype 4 | - | - | V | o | ||
| LookUptype 5 | - | - | - | - | ||
| LookUptype 6 | - | - | - | - | ||
| Lookuptype 7 | - | - | - | - | ||
| Lookuptype 8 | - | - | - | - | ||
| Jstf | - | - | - | - | ||
| MATEMÁTICA | - | - | V | V | ||
Presume que a Dune (≥2.7) esteja instalada.
$ dune build$ dune test Esta biblioteca foi desenvolvida com a intenção de reformular otfm .
Veja também:
otfm para SatysfiAlguns testes de unidade usam dados extraídos das fontes a seguir:
ipaexm.ttflmroman10-regular.otf e lmmono10-regular.otfDejaVuSans-ExtraLight.ttf