style: Add support for the 'ic' font-relative unit

This is a "simplified" implementation of 'ic', similar to what Safari Preview
currently supports: it only considers the advance of U+6C34 if found in the
first available font, and otherwise falls back to the default of 1em.

(The spec allows for this "in cases where it is impossible or impractical to
determine the ideographic advance measure".)

Differential Revision: https://phabricator.services.mozilla.com/D132818
This commit is contained in:
Jonathan Kew 2023-06-06 16:46:36 +02:00 committed by Oriol Brufau
parent 9430287183
commit 26c10339e3
4 changed files with 30 additions and 2 deletions

View file

@ -18,6 +18,8 @@ pub struct FontMetrics {
pub zero_advance_measure: Option<Length>,
/// The cap-height of the font.
pub cap_height: Option<Length>,
/// The ideographic-width of the font.
pub ic_width: Option<Length>,
/// The ascent of the font (a value is always available for this).
pub ascent: Length,
}
@ -28,6 +30,7 @@ impl Default for FontMetrics {
x_height: None,
zero_advance_measure: None,
cap_height: None,
ic_width: None,
ascent: Length::new(0.0),
}
}