HEX2OTF(1)

NAME
hex2otf - Convert a GNU Unifont .hex file to an OpenType font

SYNOPSIS
hex2otf [--help] [--version]

hex2otf operand ...

DESCRIPTION
The hex2otf utility generates an OpenType font from a GNU Unifont .hex file.

hex2otf reads a file in Unifont .hex file format, as specified with the hex=filename.hex operand, and creates an OpenType file as specified with the out=filename.otf operand. A combining character offset file may optionally be specified with the pos=combining-file operand.

TrueType and OpenType ID fields are specified with operands of the form id=string.

A dummy GPOS table can be generated with the gpos option. The following subsection describes why this is beneficial.

  GPOS RATIONALE
A dummy GPOS table is useful for positioning combining characters consistently. For example, HarfBuzz will perform fallback mark positioning on certain conditions, trying to put combining marks closer to their base characters. But it does not work well with the blank outlines generated by this utility, because blank outlines do not have relevant glyph extent values. The dummy GPOS table contains no useful position information, but its presence is enough for HarfBuzz to skip the fallback positioning. However, 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.

  OUTPUT FORMAT CONSIDERATIONS
The font format should be carefully chosen. In general, using the cff and gpos operands together will produce good results on GNU/Linux, *nix, Windows, and macOS systems. The current status of 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.

    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.

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.

--version
    Print program version information and exit.

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.

id=text
    Specify font attributes. id shall be an decimal integer from 0 to 255, 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.

    ID  Meaning and Notes

    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 of 0 to 65535.

    6   PostScript name. Less than 64 printable ASCII characters except those in “[](){}<>/%”

    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
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). This is caused by the presence of the file Adobe-Identity-0.cidmap, which FontForge interprets incorrectly to determine Unicode code point glyph mappings if present. This file is located in /usr/share/fontforge/cidmap or a similar directory on GNU/Linux systems. 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.

EXAMPLE
Sample usage:

    hex2otf hex=unifont.hex pos=combining.txt \
    format=cff,gpos,gsub out=unifont.otf

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, hex2otf writes a brief diagnostic message to STDERR; in this event, the state of the output font file will be undefined.

SEE ALSO
unifont(5), hex2bdf(1)

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.