Skip to content

Commit

Permalink
Merge branch 'master' into gfngfn/temp-debug-subset
Browse files Browse the repository at this point in the history
  • Loading branch information
gfngfn committed Sep 30, 2023
2 parents 9432582 + f3df372 commit 1a7c9fa
Show file tree
Hide file tree
Showing 34 changed files with 1,816 additions and 192 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [0.2.0] - 2023-06-27
### Changed
- Rename `Hhea.t`'s `xmax_extent` to `x_max_extent` ([PR\#45](https://github.com/gfngfn/otfed/pull/45); breaking change).
- Change the interface of `Otfed.Decode.Cmap.get_subtables` ([PR\#47](https://github.com/gfngfn/otfed/pull/47); breaking change).

### Added
- Support `vhea` tables ([PR\#45](https://github.com/gfngfn/otfed/pull/45)).
- Support `vmtx` tables ([PR\#46](https://github.com/gfngfn/otfed/pull/46)).
- Support decoding of `GPOS` Lookup Type 3, i.e., subtables for cursive attachment ([PR\#49](https://github.com/gfngfn/otfed/pull/49)).

## [0.1.0] - 2023-05-26
### Changed
- Make `Otfed.Decode.Ttf.loca` distinguish "having an empty glyph" from "undefined" (breaking change).
Expand All @@ -19,5 +29,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/),
- Initial version of Otfed


[Unreleased]: https://github.com/gfngfn/otfed/compare/0.1.0...HEAD
[Unreleased]: https://github.com/gfngfn/otfed/compare/0.2.0...HEAD
[0.2.0]: https://github.com/gfngfn/otfed/compare/0.1.0...0.2.0
[0.1.0]: https://github.com/gfngfn/otfed/compare/0.0.1...0.1.0
185 changes: 111 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@

# `otfed`: OpenType Font Format Encoder & Decoder

This library is intended to be a reformulation and extension of [`otfm`](https://github.com/dbuenzli/otfm).
## Table of Contents

See also:

* [an extended version of `otfm` for SATySFi](https://github.com/gfngfn/otfm)
* [SATySFi](https://github.com/gfngfn/SATySFi)


## Note

Some unit tests use data extracted from the following fonts:

* [IPAex明朝 (IPAex Mincho)](https://moji.or.jp/ipafont/): `ipaexm.ttf`
- See the license [here](https://moji.or.jp/ipafont/license/)
* [Latin Modern](http://www.gust.org.pl/projects/e-foundry/latin-modern): `lmroman10-regular.otf` and `lmmono10-regular.otf`
- See the license [here](http://www.gust.org.pl/projects/e-foundry/latin-modern#section-2)
* [Latin Modern Math](https://www.gust.org.pl/projects/e-foundry/lm-math)
- See the license [here](https://www.latex-project.org/lppl/)
* [Junicode](https://junicode.sourceforge.io/)
- See the license [here](https://github.com/psb1558/Junicode-font/blob/master/OFL.txt)
- [How to install](#how-to-install)
- [Usage of an example CLI `otfedcli`](#usage-of-an-example-cli-otfedcli)
- [Development status](#development-status)
- [How to develop this library](#how-to-develop-this-library)
- [Remarks](#remarks)


## How to install
Expand All @@ -46,18 +33,18 @@ $ opam install otfed
## Usage of an example CLI `otfedcli`

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

<commands> ::= [<command>]*
$ 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>.
Expand Down Expand Up @@ -121,64 +108,86 @@ $ dune exec otfedcli input/Junicode.ttf subset 0,113,302 output/Junicode-subset.
```


## Status
## Development status

* v: done
* o: no automated test has been given, but seems working correctly for many inputs
* \-: not supported yet
* Support:
- V = supported
- \- = not supported yet
* Test:
- V = having automated tests
- \- = not supported
- o = no automated test has been given, but seems to be working fine for many inputs
- x = not well-tested

<table>
<tr>
<th rowspan="2" colspan="2">Tables</th>
<th colspan="2">Encoding operations</th>
<th colspan="3">Decoding operations</th>
</tr>
<tr>
<th>Supported</th><th>Tested</th><th>Supported</th><th>Tested</th>
</tr>
<tr><td rowspan="8">Required</td>
<td>cmap</td><td>v (Format 12 only)</td><td>v (Format 12 only)</td><td>v (Format 4, 12, and 13 only)</td><td>v (Format 4 and 12 only)</td></tr>
<tr><td>head</td><td>v</td><td>v</td><td>v</td><td>v</td></tr>
<tr><td>hhea</td><td>v</td><td>v</td><td>v</td><td>v</td></tr>
<tr><td>hmtx</td><td>v</td><td>v</td><td>v</td><td>v</td></tr>
<tr><td>maxp</td><td>v</td><td>v</td><td>v</td><td>v</td></tr>
<tr><td>name</td><td>v</td><td>v</td><td>v</td><td>v</td></tr>
<tr><td>OS/2</td><td>v</td><td>v (version 2 only)</td><td>v</td><td>v (version 2 only)</td></tr>
<tr><td>post</td><td>v</td><td>v</td><td>v</td><td>v</td></tr>

<tr><td rowspan="6">TTF</td>
<td>cvt␣</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>fpgm</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>glyf</td><td>v</td><td>v</td><td>v</td><td>v</td></tr>
<tr><td>loca</td><td>v</td><td>v (short only)</td><td>v</td><td>v (long only)</td></tr>
<tr><td>prep</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>gasp</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>

<tr><td rowspan="3">CFF</td>
<td>CFF␣</td><td>v</td><td>o</td><td>v</td><td>v</td></tr>
<tr><td>CFF2</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>VORG</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>

<tr><td rowspan="1">SVG</td>
<td>SVG␣</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>

<tr><td rowspan="4">Optional</td>
<td>DSIG</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>kern</td><td>-</td><td>-</td><td>v (Format 0 only)</td><td>o</td></tr>
<tr><td>vhea</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>vmtx</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>

<tr><td rowspan="7">Advanced</td>
<td>BASE</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>GDEF</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>GPOS</td><td>-</td><td>-</td><td>v (LookupType 1, 2, 4, 5, 6, and 9 only)</td><td>o</td></tr>
<tr><td>GSUB</td><td>-</td><td>-</td><td>v (LookupType 1, 2, and 4 only)</td><td>o</td></tr>
<tr><td>JSTF</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr><td>MATH</td><td>-</td><td>-</td><td>v</td><td>v</td></tr>
<tr><th rowspan="2" colspan="3">Tables</th> <th colspan="2">Encoding operations</th><th colspan="2">Decoding operations</th></tr>
<tr> <th>Supported</th><th>Tested</th><th>Supported</th><th>Tested</th></tr>
<tr><td rowspan="19">Required</td><td rowspan="9">cmap</td><td>Format 0</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>Format 2</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>Format 4</td> <td>-</td><td>-</td><td>V</td><td>V</td></tr>
<tr> <td>Format 6</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>Format 8</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>Format 10</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>Format 12</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td>Format 13</td> <td>-</td><td>-</td><td>V</td><td>V</td></tr>
<tr> <td>Format 14</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td colspan="2">head</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td colspan="2">hhea</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td colspan="2">hmtx</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td colspan="2">maxp</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td colspan="2">name</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td rowspan="4">OS/2</td><td>ver. 0</td> <td>V</td><td>o</td><td>V</td><td>o</td></tr>
<tr> <td>ver. 1</td> <td>V</td><td>o</td><td>V</td><td>o</td></tr>
<tr> <td>ver. 2</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td>ver. 3, 4, & 5</td><td>V</td><td>o</td><td>V</td><td>o</td></tr>
<tr> <td colspan="2">post</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>

<tr><td rowspan="7">TTF</td> <td colspan="2">cvt␣</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td colspan="2">fpgm</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td colspan="2">glyf</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td rowspan="2">loca</td><td>short</td> <td>V</td><td>V</td><td>V</td><td>o</td></tr>
<tr> <td>long</td> <td>V</td><td>o</td><td>V</td><td>V</td></tr>
<tr> <td colspan="2">prep</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td colspan="2">gasp</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>

<tr><td rowspan="3">CFF</td> <td colspan="2">CFF␣</td> <td>V</td><td>o</td><td>V</td><td>V</td></tr>
<tr> <td colspan="2">CFF2</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td colspan="2">VORG</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>

<tr><td>SVG</td> <td colspan="2">SVG␣</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>

<tr><td rowspan="6">Optional</td> <td colspan="2">DSIG</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td rowspan="2">kern</td><td>Format 0</td> <td>-</td><td>-</td><td>V</td><td>V</td></tr>
<tr> <td>other</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td rowspan="2">vhea</td><td>ver. 1.0</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>
<tr> <td>ver. 1.1</td> <td>V</td><td>x</td><td>V</td><td>x</td></tr>
<tr> <td colspan="2">vmtx</td> <td>V</td><td>V</td><td>V</td><td>V</td></tr>

<tr><td rowspan="21">Advanced</td><td colspan="2">BASE</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td colspan="2">GDEF</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td rowspan="9">GPOS</td><td>LookupType 1</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 2</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 3</td> <td>-</td><td>-</td><td>V</td><td>x</td></tr>
<tr> <td>LookupType 4</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 5</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 6</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 7</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>LookupType 8</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>LookupType 9</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td rowspan="8">GSUB</td><td>LookupType 1</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 2</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 3</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>LookupType 4</td> <td>-</td><td>-</td><td>V</td><td>o</td></tr>
<tr> <td>LookupType 5</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>LookupType 6</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>LookupType 7</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td>LookupType 8</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td colspan="2">JSTF</td> <td>-</td><td>-</td><td>-</td><td>-</td></tr>
<tr> <td colspan="2">MATH</td> <td>-</td><td>-</td><td>V</td><td>V</td></tr>
</table>


## How to develop
## How to develop this library

Assumes that [Dune](https://dune.build/) (≥2.7) is installed.

Expand All @@ -193,3 +202,31 @@ $ dune build
```console
$ dune test
```


## Remarks

### Origin

This library has been developed with the intension of reformulating [`otfm`](https://github.com/dbuenzli/otfm).

See also:

* [an extended version of `otfm` for SATySFi](https://github.com/gfngfn/otfm)
* [SATySFi](https://github.com/gfngfn/SATySFi)


### Data used in unit tests

Some unit tests use data extracted from the following fonts:

* [IPAex明朝 (IPAex Mincho)](https://moji.or.jp/ipafont/): `ipaexm.ttf`
- See the license [here](https://moji.or.jp/ipafont/license/)
* [Latin Modern](http://www.gust.org.pl/projects/e-foundry/latin-modern): `lmroman10-regular.otf` and `lmmono10-regular.otf`
- See the license [here](http://www.gust.org.pl/projects/e-foundry/latin-modern#section-2)
* [Latin Modern Math](https://www.gust.org.pl/projects/e-foundry/lm-math)
- See the license [here](https://www.latex-project.org/lppl/)
* [Junicode](https://junicode.sourceforge.io/)
- See the license [here](https://github.com/psb1558/Junicode-font/blob/master/OFL.txt)
* [DejaVu Sans](https://dejavu-fonts.github.io/): `DejaVuSans-ExtraLight.ttf`
- See the license [here](https://dejavu-fonts.github.io/License.html)
Loading

0 comments on commit 1a7c9fa

Please sign in to comment.