1OT2KPX(1) Marc Penninga OT2KPX(1)
2
3
4
6 ot2kpx - extract kerning information from OpenType fonts
7
9 ot2kpx [ -afm | -kpx | -lua ] <fontfile>
10
12 ot2kpx extract the kerning data from OpenType fonts and prints it to
13 "stdout", either in Adobe's KPX format (for adding to an afm file) or
14 as a Luatex custom feature, for use with the "\directlua" command.
15
17 -help
18 Print a short help text and exit.
19
20 -version
21 Print ot2kpx's version and exit.
22
23 -afm, -kpx
24 Output the kerning data in Adobe's KPX format, as used in afm
25 files. This is the default output format.
26
27 -lua
28 Output the kerning data as a Luatex custom font feature, to be
29 included in a "\directlua" command.
30
31 <fontfile>
32 The OpenType font (both otf and ttf format are supported).
33
35 - ot2kpx doesn't implement all of the OpenType specification. Things
36 that are missing include: support for font files containing
37 multiple fonts, LookupTables with LookupTypes other than 2, "kern"
38 tables with format other than 0 and ValueRecords with other types
39 of data than just XAdvance data.
40
41 Most of these limitations won't matter, since the missing features
42 are rare (the only fonts I know of that use them are the non-
43 western fonts that come with Adobe Reader). Furthermore, many of
44 these features define (according to the OpenType specification)
45 "subtle, device-dependent adjustments at specific font sizes or
46 device resolutions"; since there's no way to express such
47 adjustments in afm format, ignoring them seems to be the only
48 option anyway.
49
50 - ot2kpx collects kerning data first from the "kern" table, then from
51 all LookupTables associated with the "kern" feature; if a kerning
52 pair occurs multiple times, the first value seen is chosen. There
53 are (or may be) several issues with this approach:
54
55 - The OpenType specification says that fonts in otf format
56 shouldn't use the "kern" table at all, just the lookups from
57 the "GPOS" table. Many such fonts do, however, contain a
58 "kern" table, but no "GPOS" table; so we use the "kern" table
59 anyway.
60
61 - Instead of reading all LookupTables, it might be better to let
62 the user specify a script and language and process only the
63 LookupTables for those values. However, at least in the fonts
64 I checked, all script/language combinations eventually point to
65 the same "kern" LookupTables, so this approach wouldn't make
66 any difference (apart from further complicating the code).
67
69 Marc Penninga <marcpenninga@gmail.com>
70
72 Copyright (C) 2005-2021 Marc Penninga.
73
75 This program is free software; you can redistribute it and/or modify it
76 under the terms of the GNU General Public License as published by the
77 Free Software Foundation, either version 2 of the License, or (at your
78 option) any later version. A copy of the GNU General Public License is
79 included with ot2kpx; see the file GPLv2.txt.
80
82 This program is distributed in the hope that it will be useful, but
83 WITHOUT ANY WARRANTY; without even the implied warranty of
84 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85 General Public License for more details.
86
88 This document describes ot2kpx version 20210401.
89
91 (See the source code for the rest of the story.)
92
93 2019-05-20 Added the -version option.
94
95 2019-04-15 Added the -lua command-line option to get output in
96 Luatex's custom feature format.
97
98
99
100fontools 2021-04-01 OT2KPX(1)