Skip to content

Conversation

@Drulokia
Copy link

PR Summary: Add Family Grouping, Texture Size Control, and Pagination Features

Overview

This PR enhances the Lightning 3 SDF Font Generator with new command-line options and features that provide better control over font atlas generation and organization. When doing pnpm generate as before you get same result as before, but with working pages.

Fixes

  • Previously, when glyphs did not fit within the texture atlas dimensions, the generator was limited to only 1 page, last page was stored, so missing glyphs

Key Features Added

Family Grouping Mode

  • New CLI option: --family or -f
  • Groups fonts by font family (Regular, Bold, Italic, etc.) into separate pages within the same atlas
  • Restriction: Only supports TTF/OTF files (WOFF/WOFF2 formats are not supported in family mode)
  • In overrides.json the Family name needs to be used not the filename.

Individual Mode (Like before)

  • New CLI option: --individual or -i (default behavior)
  • Generates separate atlases for each font file
  • Supports all font formats including WOFF and WOFF2
  • Maintains backward compatibility as the default mode

Texture Size Configuration

  • New override options: textureWidth and textureHeight
  • Default values: 2048x2048 pixels
  • Allows customization of output PNG texture atlas dimensions
  • Can be configured per-font in the font-src/overrides.json file

Command Line Interface

  • New CLI structure: pnpm generate [options]
  • Available options:
    • --family, -f: Group fonts by family
    • --individual, -i: Generate individual fonts (default)
    • --help, -h: Show help message

Examples:

pnpm generate --family
pnpm generate --individual
pnpm generate --help

pnpm generate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant