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
- Prepare measured font or typeset-layout values and the explicit design policy requested. For text or font bytes, use the supported syntax explained below.
- Enter glyphCountsByClass, callerBytesPerGlyphByClass, callerFixedTableBytes, callerDirectoryRecordCount, alignmentBytes using the field table and calculation rules, then run the tool.
- Read modelGlyphBytes, modelUncompressedFontBytes. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- 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 field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| glyphCountsByClass | Glyph counts by class | list of number | Required |
| callerBytesPerGlyphByClass | Caller bytes per glyph by class | list of number | Required |
| callerFixedTableBytes | Caller fixed table bytes | number | Required |
| callerDirectoryRecordCount | Caller directory record count | number | Required |
| alignmentBytes | Alignment bytes | number | Required |
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 field | Meaning | Value type |
|---|---|---|
| modelGlyphBytes | Model glyph bytes | number |
| modelUncompressedFontBytes | Model uncompressed font bytes | number |
{
"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
-
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.