Inline Code Monospace x-Height Match

Match inline-code and body actual x-height from independent font-unit metrics; not generic em conversion or assurance of equal stroke weight/baseline/cap height.

Description

Matching inline code to body x-height requires independent metrics from both fonts.

Matching inline code to body x-height requires independent metrics from both fonts. Equal x-height does not imply equal weight or baselines.1

Enter all positive metrics and size. Return body visible x-height, matched code size and code/body ratio.

When to use Inline Code Monospace x-Height Match

Use Inline Code Monospace x-Height Match when you need to evaluate the supplied records under the calculation and evidence rules below. No font-file extraction, cap-height match or stroke/baseline equivalence is established.

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 Inline Code Monospace x-Height Match 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 bodyFontSizePx, bodyXHeightUnits, bodyUnitsPerEm, codeXHeightUnits, codeUnitsPerEm using the field table and calculation rules, then run the tool.
  3. Read bodyVisibleXHeightPx, matchedCodeFontSizePx, codeToBodySizeRatio. 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
bodyFontSizePxBody font size pxnumberRequired
bodyXHeightUnitsBody x height unitsnumberRequired
bodyUnitsPerEmBody units per emnumberRequired
codeXHeightUnitsCode x height unitsnumberRequired
codeUnitsPerEmCode units per emnumberRequired

Enter all positive metrics and size. Return body visible x-height, matched code size and code/body ratio.

bodyXHeight=bodySize×bodyXHeightUnits/bodyUPM; codeSize=bodyXHeight×codeUPM/codeXHeightUnits

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

Output fieldMeaningValue type
bodyVisibleXHeightPxBody visible x height pxnumber
matchedCodeFontSizePxMatched code font size pxnumber
codeToBodySizeRatioCode to body size rationumber
json
{
  "input": {
    "bodyFontSizePx": 16,
    "bodyXHeightUnits": 500,
    "bodyUnitsPerEm": 1000,
    "codeXHeightUnits": 450,
    "codeUnitsPerEm": 1000
  },
  "output": {
    "bodyVisibleXHeightPx": 8,
    "matchedCodeFontSizePx": 17.77777777777778,
    "codeToBodySizeRatio": 1.1111111111111112
  }
}

Limitations and assumptions

No font-file extraction, cap-height match or stroke/baseline equivalence is established.

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 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. For a complementary task, use Fallback Metrics Ascent/Descent Override: Font metrics overrides and size-adjust scaling interact. The requested percentages must account for scaling to reach the target layout metrics.

References

  1. Inline Code Monospace x-Height Match — tool.io

Similar or alternative tools

  • 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.

  • Fallback Metrics Ascent/Descent Override

    Font metrics overrides and size-adjust scaling interact. The requested percentages must account for scaling to reach the target layout metrics.

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