mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Add support for the 'cap' font-relative unit
This is a backport of https://phabricator.services.mozilla.com/D133101, by Jonathan Kew. Note that Servo isn't using font metrics yet, so the unit still won't really work.
This commit is contained in:
parent
61f872e7da
commit
6785c57c78
5 changed files with 68 additions and 8 deletions
|
@ -979,7 +979,12 @@ impl FontMetricsProvider for GeckoFontMetricsProvider {
|
|||
};
|
||||
|
||||
let vertical_metrics = match orientation {
|
||||
FontMetricsOrientation::MatchContext => wm.is_vertical() && wm.is_upright(),
|
||||
FontMetricsOrientation::MatchContextPreferHorizontal => {
|
||||
wm.is_vertical() && wm.is_upright()
|
||||
},
|
||||
FontMetricsOrientation::MatchContextPreferVertical => {
|
||||
wm.is_vertical() && !wm.is_sideways()
|
||||
},
|
||||
FontMetricsOrientation::Horizontal => false,
|
||||
};
|
||||
let gecko_metrics = unsafe {
|
||||
|
@ -999,6 +1004,12 @@ impl FontMetricsProvider for GeckoFontMetricsProvider {
|
|||
} else {
|
||||
None
|
||||
},
|
||||
cap_height: if gecko_metrics.mCapHeight.px() >= 0. {
|
||||
Some(gecko_metrics.mCapHeight)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
ascent: gecko_metrics.mAscent,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue