HEX2OTF(1) General Commands Manual HEX2OTF(1)

# [NAME](#NAME)

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

# [SYNOPSIS](#SYNOPSIS)

**hex2otf** \[--help] \[--version]

**hex2otf** *operand* ...

# [DESCRIPTION](#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](#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](#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](#CFF)

May cause rendering issues in the Windows Command Prompt program.

[CFF 2 outline](#CFF~2)

Not recognized by Windows.

[TrueType outline](#TrueType)

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](#Bitmap_only)

Contrary to the OpenType specification, a bitmap-only font has to be accompanied by blank outlines to be recognized.

## [FUTURE DIRECTIONS](#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](#OPTIONS)

[**--help**](#help)

Print a brief help message and exit.

[**--version**](#version)

Print program version information and exit.

# [OPERANDS](#OPERANDS)

[**hex**=*file*](#hex)

Specify the input hex file pathname.

[**pos**=*file*](#pos)

Optional. Specify the combining position file pathname.

[**out**=*file*](#out)

Specify the output pathname.

[**format**=*word*\[,*word* ...\]](#format)

Specify the font format. Each *word* shall be one of the following:

[**cff**](#cff)

Generate CFF outlines.

[**cff2**](#cff2)

Generate CFF 2 outlines.

[**truetype**](#truetype)

Generate TrueType outlines.

[**blank**](#blank)

Generate blank outlines. Generating a font with only blank outlines is not allowed.

[**bitmap**](#bitmap)

Generate embedded bitmap. Required if no outlines are generated.

[**gpos**](#gpos)

Generate dummy GPOS table. See the "GPOS RATIONALE" section above.

[**gsub**](#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*](#id)

Specify font attributes. *id* shall be an decimal integer from 0 to 255, corresponding to “Name ID” as defined in the OpenType specification, &lt;https://docs.microsoft.com/en-us/typography/opentype/spec/name#name-ids&gt;. *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**](#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 “*\[](){}&lt;&gt;/%*”

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](#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](#EXAMPLE)

Sample usage:

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

# [EXIT STATUS](#EXIT_STATUS)

Status values are defined in &lt;stdlib.h&gt;. 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](#SEE_ALSO)

[**unifont**(5)](/man/enterprise-packages/font-unifont/unifont.5), [**hex2bdf**(1)](/man/enterprise-packages/font-unifont/hex2bdf.1)

# [AUTHOR](#AUTHOR)

**hex2otf** was written by He Zhixiang.

# [LICENSE](#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.

2022-03-19 GNU Unifont

---

Document: hex2otf(1) from font-unifont 17.0.04-r2 (Chainguard OS)
Source: https://unifoundry.com/pub/unifont/unifont-17.0.04/unifont-17.0.04.tar.gz
