Font File Size Estimate From Glyph Count

Budget uncompressed SFNT bytes from caller glyph-class costs, per-glyph alignment, table overhead and directory records; explicit estimate, not WOFF compression or exact real glyph size.

Description

Uncompressed SFNT budgeting combines per-glyph class costs with table and directory overhead.

Uncompressed SFNT budgeting combines per-glyph class costs with table and directory overhead. Compression changes the eventual file size.1

Enter aligned nonempty nonnegative integer glyph counts, nonnegative class bytes, nonnegative integer fixed/directory counts and integer alignment 1–64. Return glyph and total modeled bytes; accumulated counts must remain safe integers.

When to use Font File Size Estimate From Glyph Count

Use Font File Size Estimate From Glyph Count when you need to evaluate the supplied records under the calculation and evidence rules below. Per-glyph alignment is an explicit model assumption. No actual font size, rewritten table cost or WOFF compression is predicted independently.

Prepare measured font or typeset-layout values and the explicit design policy requested. For text or font bytes, use the supported syntax explained below.

How to use Font File Size Estimate From Glyph Count and understand its results

  1. Prepare measured font or typeset-layout values and the explicit design policy requested. For text or font bytes, use the supported syntax explained below.
  2. Enter glyphCountsByClass, callerBytesPerGlyphByClass, callerFixedTableBytes, callerDirectoryRecordCount, alignmentBytes using the field table and calculation rules, then run the tool.
  3. Read modelGlyphBytes, modelUncompressedFontBytes. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
glyphCountsByClassGlyph counts by classlist of numberRequired
callerBytesPerGlyphByClassCaller bytes per glyph by classlist of numberRequired
callerFixedTableBytesCaller fixed table bytesnumberRequired
callerDirectoryRecordCountCaller directory record countnumberRequired
alignmentBytesAlignment bytesnumberRequired

Enter aligned nonempty nonnegative integer glyph counts, nonnegative class bytes, nonnegative integer fixed/directory counts and integer alignment 1–64. Return glyph and total modeled bytes; accumulated counts must remain safe integers.

glyphBytes=sum(count×ceil(bytesPerGlyph/alignment)×alignment); total=glyphBytes+fixed+12+16records

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
modelGlyphBytesModel glyph bytesnumber
modelUncompressedFontBytesModel uncompressed font bytesnumber
json
{
  "input": {
    "glyphCountsByClass": [
      10,
      20
    ],
    "callerBytesPerGlyphByClass": [
      100,
      200
    ],
    "callerFixedTableBytes": 1000,
    "callerDirectoryRecordCount": 10,
    "alignmentBytes": 4
  },
  "output": {
    "modelGlyphBytes": 5000,
    "modelUncompressedFontBytes": 6172
  }
}

Limitations and assumptions

Per-glyph alignment is an explicit model assumption. No actual font size, rewritten table cost or WOFF compression is predicted independently.

Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Numeric lists are limited to 10,000 entries; string lists to 128 strings of at most 128 characters each. The rules above may impose smaller limits. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use Webfont Subset Savings Percent Glyphs: Font subsets may require transitive composite-glyph dependencies. Byte savings differ from glyph-count savings. For a complementary task, use x-Height Ratio From Font File: A font’s x-height ratio relates a native metric to units per em. Missing native metrics should be represented separately from measured outline height.

References

  1. Font File Size Estimate From Glyph Count — tool.io

Similar or alternative tools

  • Webfont Subset Savings Percent Glyphs

    Font subsets may require transitive composite-glyph dependencies. Byte savings differ from glyph-count savings.

  • x-Height Ratio From Font File

    A font’s x-height ratio relates a native metric to units per em. Missing native metrics should be represented separately from measured outline height.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies