layout: Turn on synthetic small-caps for layout 2020 (#31435)

Synthetic small caps is supported by the font subsystem, but this is
disabled in Layout 2020. We can turn this on to bring support to parity
with the old layout system.

In addition to turning on synthetic small-caps this change also improves
the way that they work. Before, synthetic small caps meant that every
character was a small version of capitalized character. After this
change, capital letters are larger than small caps versions of small
letters -- matching other browsers and the common expectation of how
small caps works.
This commit is contained in:
Martin Robinson 2024-02-28 16:09:26 +01:00 committed by GitHub
parent 98bd306816
commit 5ba29c20ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 214 additions and 176 deletions

View file

@ -664,11 +664,14 @@ impl RunInfo {
}
fn has_font(&self, font: &Option<FontRef>) -> bool {
fn identifier(font: &Option<FontRef>) -> Option<Atom> {
font.as_ref().map(|f| f.borrow().identifier())
fn identifier_and_pt_size(font: &Option<FontRef>) -> Option<(Atom, Au)> {
font.as_ref().map(|font| {
let font = font.borrow();
(font.identifier(), font.descriptor.pt_size)
})
}
identifier(&self.font) == identifier(font)
identifier_and_pt_size(&self.font) == identifier_and_pt_size(font)
}
}