ch Unit Line Length Checker
Distinguish CSS ch (zero-glyph advance) from caller observed text mean advance and nominal CPL; unlike em/ch-width conversion, actual glyph calibration is explicit, not exact wrapping.
Description
CSS ch measures the zero glyph’s advance.
CSS ch measures the zero glyph’s advance. Actual characters per line depend on the mean advance of the text being set.1
Enter nonnegative ch length/expected CPL and positive measured advances. Return modeled width, estimated CPL and signed departure from expected.
When to use ch Unit Line Length Checker
Use ch Unit Line Length Checker when you need to evaluate the supplied records under the calculation and evidence rules below. No exact wrapping, shaping or language-specific line breaking is modeled.
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 ch Unit Line Length Checker 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 cssChLength, measuredZeroGlyphAdvancePx, measuredMeanTextGlyphAdvancePx, callerExpectedCpl using the field table and calculation rules, then run the tool.
- Read modeledLineWidthPx, estimatedActualCharactersPerLine, signedCplDeparture. 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 |
|---|---|---|---|
| cssChLength | Css ch length | number | Required |
| measuredZeroGlyphAdvancePx | Measured zero glyph advance px | number | Required |
| measuredMeanTextGlyphAdvancePx | Measured mean text glyph advance px | number | Required |
| callerExpectedCpl | Caller expected cpl | number | Required |
Enter nonnegative ch length/expected CPL and positive measured advances. Return modeled width, estimated CPL and signed departure from expected.
width=chLength×zeroAdvance; CPL=width/meanAdvance Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| modeledLineWidthPx | Modeled line width px | number |
| estimatedActualCharactersPerLine | Estimated actual characters per line | number |
| signedCplDeparture | Signed cpl departure | number |
{
"input": {
"cssChLength": 60,
"measuredZeroGlyphAdvancePx": 10,
"measuredMeanTextGlyphAdvancePx": 5,
"callerExpectedCpl": 60
},
"output": {
"modeledLineWidthPx": 600,
"estimatedActualCharactersPerLine": 120,
"signedCplDeparture": 60
}
} Limitations and assumptions
No exact wrapping, shaping or language-specific line breaking is modeled.
Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use Optimal Measure Characters-Per-Line: Characters per line depend on word advances and wrapping, not just nominal font size. A greedy word model makes unbreakable overflows visible. For a complementary task, use Column Count From Text Width: Column packing accounts for N−1 gutters between N columns. Insufficient width should yield an explicit zero-column result.
References
-
ch Unit Line Length Checker — tool.io
Similar or alternative tools
- Optimal Measure Characters-Per-Line
Characters per line depend on word advances and wrapping, not just nominal font size. A greedy word model makes unbreakable overflows visible.
- Column Count From Text Width
Column packing accounts for N−1 gutters between N columns. Insufficient width should yield an explicit zero-column result.