HEX2OTF(1)
π HEX2OTF(1) β the little font-making bestie π
okay so real talk, this is the manual page for hex2otf, a General Commands Manual situation, and honestly? she ate. let's get into it π«Ά
β¨ NAME β¨
hex2otf β bestie, this converts a GNU Unifont .hex file into an OpenType font. that's the whole gig. slay π
πΈ SYNOPSIS πΈ
hex2otf [--help] [--version]
hex2otf operand ...
π¦ DESCRIPTION π¦
so hex2otf generates an OpenType font from a GNU Unifont .hex file. iconic behavior, no notes.
here's the vibe: hex2otf reads a file in Unifont .hex file format β you specify that with the hex=filename.hex operand β and then it creates an OpenType file, which you specify with the out=filename.otf operand. β¨
and like, optionally? you can also hand it a combining character offset file with the pos=combining-file operand. cute, optional, we love a flexible queen.
TrueType and OpenType ID fields are set with operands shaped like id=string.
also you can generate a dummy GPOS table with the gpos option. and the next subsection is literally the whole reason why that's a good idea, so stay with me π
π GPOS RATIONALE π
okay so a dummy GPOS table is useful for positioning combining characters consistently. here's why, fr fr:
HarfBuzz will do fallback mark positioning under certain conditions, trying to put combining marks closer to their base characters. sounds helpful, right? nope. it does not work well with the blank outlines that this utility generates, because blank outlines don't have relevant glyph extent values. like, there's nothing there to measure, bestie π
the dummy GPOS table contains no useful position information, but its presence alone is enough for HarfBuzz to skip the fallback positioning. the way that works is so funny to me. it's giving "just being in the room changes everything."
however β and this is the important bit β both HarfBuzz and Uniscribe will still precompose characters before rendering. for example, "a\u0301" is rendered exactly as the glyph of U+00E1 (LATIN SMALL LETTER A WITH ACUTE), not the composite of two glyphs. periodt. π
π OUTPUT FORMAT CONSIDERATIONS π
choose your font format carefully, bestie β this is not a drill. in general, using the cff and gpos operands together will produce good results on GNU/Linux, *nix, Windows, and macOS systems. so that's the combo meal. π
the current status of the different formats is as follows:
- CFF outline β May cause rendering issues in the Windows Command Prompt program. π
- CFF 2 outline β Not recognized by Windows.
- TrueType outline β On Windows, this appears to be blurred in 16 pixels size due to the ClearType anti-alias mechanism; this can be fixed by embedding bitmaps. (ngl this one's a journey)
- Bitmap-only β Contrary to the OpenType specification, a bitmap-only font has to be accompanied by blank outlines to be recognized.
π§ FUTURE DIRECTIONS π§
Some font parameters are hard coded into the source code for convenience. Other approaches may be preferable. (they said "convenience," we said "okay but there are other ways," iykyk)
The generated fonts may produce incorrect result for vertical layout. More font parameters might be necessary if such a need arises.
Font size may be reduced by using e.g. CFF subroutines and TrueType font programs. π
π OPTIONS π
--helpβ Print a brief help message and exit. short, sweet, helpful.--versionβ Print program version information and exit. know your queen's version number π
π OPERANDS π
hex=fileβ Specify the input hex file pathname.pos=fileβ Optional. Specify the combining position file pathname.out=fileβ Specify the output pathname.format=word[,word ...]β Specify the font format. Each word shall be one of the following:cffβ Generate CFF outlines.cff2β Generate CFF 2 outlines.truetypeβ Generate TrueType outlines.blankβ Generate blank outlines. Generating a font with only blank outlines is not allowed. π«bitmapβ Generate embedded bitmap. Required if no outlines are generated.gposβ Generate dummy GPOS table. See the "GPOS RATIONALE" section above. πgsubβ Generate generic GSUB table with two entries:"DFLT"and"thai"."DFLT"improves glyph positioning in HarfBuzz, especially as relates to glyph reordering."thai"directs HarfBuzz not to obtain Thai glyphs from the Unicode Private Use Area. iconic table, honestly.
id=textβ Specify font attributes. id shall be an decimal integer from0to255, corresponding to "Name ID" as defined in the OpenType specification, <https://docs.microsoft.com/en-us/typography/opentype/spec/name#name-ids>. text shall be value of the attribute in English (United States). Characters beyond the ASCII range shall be encoded as UTF-8. Currently defined attributes relevant to Unifont are briefly listed below. Refer to the specification for full details.0β Copyright notice.1β Font family name.2β Font subfamily name. Should be"Regular".3β Unique font identifier.4β Full font name.5β Version string. Should begin with"Version number.number", where each number is in the range of0to65535.6β PostScript name. Less than 64 printable ASCII characters except those in"[](){}<>/%"β so watch out for those characters, bestie, they're banned π«7β Trademark.8β Manufacturer name.9β Designer.10β Description.11β Vendor URL.12β Designer URL.13β License description, in plain language.14β License info URL.18β Compatible full name; Macintosh only.19β Sample text.
π FONTFORGE NOTE π
okay this one's a whole saga so listen up. Default FontForge package installations can incorrectly ignore the Unicode plane of glyphs beyond Plane 0 in CID-keyed fonts (such as are generated with the format=cff option). not great!! π
the cause? the presence of the file Adobe-Identity-0.cidmap, which FontForge interprets incorrectly to determine Unicode code point glyph mappings if present.
this file lives in /usr/share/fontforge/cidmap or a similar directory on GNU/Linux systems.
the fix: removing or renaming Adobe-Identity-0.cidmap will cause FontForge to fall back on OpenType cmap entries in the font. FontForge will then correctly display all Unicode code points. we love a happy ending β¨
β EXAMPLE β
Sample usage:
hex2otf hex=unifont.hex pos=combining.txt \
format=cff,gpos,gsub out=unifont.otf
look at her go π₯Ή
π EXIT STATUS π
Status values are defined in <stdlib.h>. The program exits with status EXIT_SUCCESS upon successful font generation, or EXIT_FAILURE if an error occurred.
β οΈ if an error condition is encountered,hex2otfwrites a brief diagnostic message toSTDERR; in this event, the state of the output font file will be undefined. like, genuinely undefined, bestie. don't trust that file. π
π₯ SEE ALSO π₯
π AUTHOR π
hex2otf was written by He Zhixiang. π
π LICENSE π
hex2otf is Copyright Β© 2022 He Zhixiang.
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.
okay that's the whole page, bestie!! π this dropped as part of GNU Unifont and the version is dated 2022-03-19 β go make some fonts, and remember: pick your format carefully, ship responsibly, and always close your tags. π¦β¨π
π¦ where this page comes from
- alpine 3.23: unifont-doc 17.0.03-r0 Β· GFDL-1.3-or-later GPL-2.0-or-later WITH Font-exception-2.0
- alpine 3.24: unifont-doc 17.0.04-r0 Β· GFDL-1.3-or-later GPL-2.0-or-later WITH Font-exception-2.0
- nixpkgs unstable: unifont 18.0.01
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms