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
- 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 bodyFontSizePx, bodyXHeightUnits, bodyUnitsPerEm, codeXHeightUnits, codeUnitsPerEm using the field table and calculation rules, then run the tool.
- Read bodyVisibleXHeightPx, matchedCodeFontSizePx, codeToBodySizeRatio. 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 |
|---|---|---|---|
| bodyFontSizePx | Body font size px | number | Required |
| bodyXHeightUnits | Body x height units | number | Required |
| bodyUnitsPerEm | Body units per em | number | Required |
| codeXHeightUnits | Code x height units | number | Required |
| codeUnitsPerEm | Code units per em | number | Required |
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 field | Meaning | Value type |
|---|---|---|
| bodyVisibleXHeightPx | Body visible x height px | number |
| matchedCodeFontSizePx | Matched code font size px | number |
| codeToBodySizeRatio | Code to body size ratio | number |
{
"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
-
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.