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