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 \directlua command. for the lua girlies 🧚
  • <fontfile> β€” the OpenType font itself. and bestie, both otf and ttf format are supported, so bring whichever. πŸ’–

πŸ’€ RESTRICTIONS πŸ’€

listen, she's not perfect, and she's not gonna pretend to be. here's the honest rundown:

  • ot2kpx doesn't implement the whole OpenType spec. the missing bits include: support for font files containing multiple fonts, LookupTables with LookupTypes other than 2, kern tables with a format other than 0, 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. πŸ™ˆ

  • ot2kpx collects kerning data first from the kern table, then from all LookupTables associated with the kern feature. 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 otf format shouldn't use the kern table at all, only the lookups from the GPOS table. but like… many such fonts do contain a kern table and no GPOS table, so we just use the kern table 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 kern LookupTables, so this approach wouldn't make any difference (apart from further complicating the code). so yeah. not worth it. periodt.

πŸ’œ AUTHOR πŸ’œ

Marc Penninga <marcpenninga@gmail.com> β€” the legend behind this whole operation 🫢


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 -version option.
  • 2019-04-15 β€” Added the -lua command-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 πŸ’–βœ¨