OT2KPX(1)
β¨ OT2KPX β¨
okay bestie, sit DOWN because today we're talking about ot2kpx, a little cutie from the fontools fam that pulls the kerning tea out of OpenType fonts π
π NAME π
ot2kpx β extract kerning information from OpenType fonts
like, it goes into your font, finds all the kerning pairs, and hands them to you. no cap. πΈ
π¦ SYNOPSIS π¦
ot2kpx [ -afm | -kpx | -lua ] <fontfile>
π DESCRIPTION π
so ot2kpx grabs the kerning data out of OpenType fonts and prints it to stdout, and it can do that in two whole flavours: either in Adobe's KPX format (which is the vibe when you wanna add stuff to an afm file), or as a Luatex custom feature, ready to be dropped into a \directlua command. pick your fighter β¨
π OPTIONS AND ARGUMENTS π
-helpβ prints a short help text and dips. bye! π-versionβ prints ot2kpx's version and dips. iconic behaviour honestly.-afm,-kpxβ outputs the kerning data in Adobe's KPX format, the kind used in afm files. this is the default output format, so if you don't say anything, this is what you get. she's the main character. π-luaβ outputs the kerning data as a Luatex custom font feature, meant to be included in a\directluacommand. for the lua girlies π§<fontfile>β the OpenType font itself. and bestie, bothotfandttfformat are supported, so bring whichever. π
π RESTRICTIONS π
listen, she's not perfect, and she's not gonna pretend to be. here's the honest rundown:
ot2kpxdoesn't implement the whole OpenType spec. the missing bits include: support for font files containing multiple fonts, LookupTables with LookupTypes other than2,kerntables with a format other than0, and ValueRecords with any data type other than just XAdvance data.
ngl, most of these limitations won't matter, because the missing features are rare β the only fonts I know of that use them are the non-western fonts that ship with Adobe Reader. and also, a lot of these features define (per the OpenType specification) "subtle, device-dependent adjustments at specific font sizes or device resolutions"; and since there's literally no way to express adjustments like that in afm format, ignoring them is kinda the only option anyway. so. π
ot2kpxcollects kerning data first from thekerntable, then from all LookupTables associated with thekernfeature. and if a kerning pair shows up multiple times, the first value seen is chosen. there are (or may be) several issues with this approach:- The OpenType specification says fonts in
otfformat shouldn't use thekerntable at all, only the lookups from theGPOStable. but likeβ¦ many such fonts do contain akerntable and noGPOStable, so we just use thekerntable anyway. we're doing our best. π - Instead of reading all LookupTables, it might be better to let the user specify a script and language and process only the LookupTables for those values. HOWEVER β at least in the fonts I checked β all script/language combinations eventually point to the same
kernLookupTables, so this approach wouldn't make any difference (apart from further complicating the code). so yeah. not worth it. periodt.
- The OpenType specification says fonts in
π AUTHOR π
Marc Penninga <marcpenninga@gmail.com> β the legend behind this whole operation π«Ά
πΈ COPYRIGHT πΈ
Copyright (C) 2005-2025 Marc Penninga.
π LICENSE π
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. A copy of the GNU General Public License is included with ot2kpx; see the file GPLv2.txt.
β DISCLAIMER β
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. so like, she's trying her best, but no promises. π
π¦ VERSION π¦
This document describes ot2kpx version 20250107.
π₯ RECENT CHANGES π₯
(see the source code for the rest of the story, bestie β this is just the highlights reel)
2019-05-20β Added the-versionoption.2019-04-15β Added the-luacommand-line option to get output in Luatex's custom feature format.
okay that's the whole page!! she ate and left no crumbs π this was fontools, dated 2025-01-07, and you just read the OT2KPX(1) manual page β go kern something cute πβ¨
π¦ where this page comes from
- debian trixie: texlive-font-utils 2024.20250309-2
- fedora 44: texlive-fontools 12:svn78330-105.fc44 Β· GPL-2.0-or-later
- fedora 44: texlive-fontools 12:svn78330-111.fc44 Β· GPL-2.0-or-later
- opensuse-leap 16.0: texlive-fontools-doc 2025.221.svn73362-160000.3.1 Β· GPL-2.0-or-later
- ubuntu questing: texlive-font-utils 2024.20250309-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms