Line Length mm From CPL and Em

Line length from actual mean glyph advance in em and CPL, not a fixed half-em font assumption.

Description

Estimate text measure in millimeters from character count and measured mean advance.

A target character count and average glyph advance can estimate a text measure before full shaping. The average must describe the intended font and text closely enough for the estimate's purpose.

When to use this tool

Estimate text measure in millimeters from character count and measured mean advance. Use it when the input measurements and conventions below match the operation you need.

  • Prepare charactersPerLine, emMm, measuredMeanAdvanceEm, respecting the measurement basis and boundaries below.
  • Compare the worked example with your intended operation before reusing its result.

How to use the tool and how it works

  1. Enter every field in the input table using the stated units and exact supported selector spelling where applicable.
  2. Run the tool. Correct input errors before interpreting an output.
  3. Read the result fields below; use accompanying flags and the stated sign, boundary or model convention when interpreting a number.

Characters per line must be nonnegative, and em size in millimeters and mean advance in em units positive. Estimated line length is characters per line times em millimeters times mean advance in em units.1

Input fieldMeaning and unitsAccepted input
charactersPerLineCharacters per line.Finite number; zero or greater
emMmEm mm. Millimeters.Finite number; greater than zero
measuredMeanAdvanceEmMeasured mean advance em. Em units.Finite number; greater than zero
Output fieldInterpretation
resultObject containing the following named result fields.
result.lineLengthMmLine length mm; use the stated units and sign convention.
json
{
  "input": {
    "charactersPerLine": 60,
    "emMm": 4,
    "measuredMeanAdvanceEm": 0.5
  },
  "output": {
    "result": {
      "lineLengthMm": 120
    }
  }
}

Limitations and assumptions

  • This average-width model does not shape text, wrap words or account for individual glyph distribution, kerning and justification. It is not an exact rendered line width.
  • Every declared field is required and unexpected fields are rejected. Numeric inputs must be finite; input errors are distinct from a valid false result or an explicitly qualified output.
  • Extremely large inputs and nonfinite or excessively large outputs are rejected. List positions reported by the tool use zero-based indices unless stated otherwise.

Alternative or Complementary methods

Compare the metric calculation with the intended font and rendered text. Font shaping and layout inspection are more appropriate when the task depends on actual glyph positions or reading conditions. Compare the scope of the nearby tools below before substituting one.

References

  1. Tool behavior and example: Line Length mm From CPL and Em — tool.io

Similar or alternative tools

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