TrueType TTC Bundler with Glyph Sharing

raw JSON →
0.10.2 verified Thu Apr 23 auth: no javascript

otfcc-ttcize is a command-line utility designed to bundle multiple TrueType (TTF) font files into a single TrueType Collection (TTC) file, with a focus on optimizing file size through glyph sharing. It is currently at version 0.10.2 and appears to be actively maintained as part of the broader otfcc toolchain, though specific release cadences are not explicitly stated. A key differentiator is its glyph sharing mechanism, which significantly reduces the final TTC file size by consolidating common glyphs across the bundled fonts. However, it's crucial to note that this glyph sharing functionality is *not* applicable to CFF (Compact Font Format) fonts, for which users are advised to consider `otf2otc` instead. The tool relies on external `otfcc` executables for its underlying font processing operations.

error Error: Command failed: otfccdump ...
cause The `otfccdump` or `otfccbuild` executable could not be found or executed by `otfcc-ttcize`.
fix
Verify that otfcc tools are installed and their executables are in your system's PATH, or use --otfccdump-command=<path> and --otfccbuild-command=<path> to specify their locations.
error No input files specified.
cause The command was run without providing any TrueType font files as input.
fix
Provide one or more .ttf files as arguments before the output option: otfcc-ttcize -o output.ttc font1.ttf font2.ttf.
error Error: 'output.ttc' already exists. Use --overwrite to force.
cause The specified output file name already exists, and the tool prevents overwriting by default.
fix
Choose a different output file name, or add the --overwrite option to explicitly allow overwriting the existing file.
gotcha Glyph sharing, a core feature for size reduction, is explicitly stated not to work for CFF (Compact Font Format) fonts. Attempting to process CFF fonts may result in unexpected behavior or lack of optimization.
fix For CFF font collections, consider using `otf2otc` instead of `otfcc-ttcize` if glyph sharing is desired, or convert CFF fonts to TrueType first if possible.
breaking Using the 'gap mode' (`-x` option) to support more than 65,535 glyph data in one TTC may cause compatibility issues with legacy software. This mode modifies how glyph data is stored.
fix Avoid using the `-x` option if the target environment includes older operating systems or font rendering engines that might have compatibility issues. Test the output TTC thoroughly on target platforms.
gotcha The hint wrapping feature (`-h` option) is automatically disabled when 'gap mode' (`-x`) is enabled. This means you cannot have both optimizations simultaneously.
fix Decide which optimization is more critical: increased glyph capacity via gap mode or preserved hint wrapping. If hint wrapping is essential, do not use gap mode.
gotcha The tool relies on external `otfccdump` and `otfccbuild` executables. If these are not found in the system's PATH, or if the specified paths are incorrect, `otfcc-ttcize` will fail to execute.
fix Ensure that `otfcc` tools are properly installed and accessible. Either add their installation directory to your system's PATH environment variable or specify their exact paths using the `--otfccdump-command` and `--otfccbuild-command` options.
npm install otfcc-ttcize
yarn add otfcc-ttcize
pnpm add otfcc-ttcize

Demonstrates bundling multiple TrueType fonts into a TTC and using advanced options like gap mode and custom otfcc executable paths.

# First, ensure otfcc tools (otfccdump, otfccbuild) are installed and in your PATH.
# For example, install otfcc via npm globally if it's a wrapper, or directly from source.
# npm install -g otfcc # (If otfcc has a CLI npm package)

# Example: Bundle two TrueType fonts into a single TTC file.
# The output TTC will have shared glyph data where possible.
otfcc-ttcize -o output.ttc input1.ttf input2.ttf input3.ttf

# Example with gap mode for larger glyph sets and custom otfcc paths.
# Note: Gap mode (-x) disables hint wrapping (-h).
otfcc-ttcize \
  -x \
  --otfccdump-command="/opt/local/bin/otfccdump" \
  --otfccbuild-command="/opt/local/bin/otfccbuild" \
  -o large_output.ttc fontA.ttf fontB.ttf