Skip to content

Conversation

mrobinson
Copy link
Member

@mrobinson mrobinson commented May 1, 2024

This flag ensures that these fonts are rendered full color in WebRender,
allowing for full color emoji.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes, but only the manual test added here.
    This is tricky to test via WPT because color fonts are sometimes bitmap
    fonts and sometimes fonts with COLR layers. In addition, we don't run tests
    for MacOS on the bots. The hope is that there can be good automated tests for this
    for the Linux implementation.

@mrobinson mrobinson requested a review from mukilan May 1, 2024 08:33
@mrobinson
Copy link
Member Author

Before this change:
Screenshot 2024-05-01 at 10 27 54

After this change:
Screenshot 2024-05-01 at 10 30 18

There's more work to do here, but this is one step on the way to proper emoji support on MacOS and other platforms.

…acOS

This flag ensures that these fonts are rendered full color in WebRender,
allowing for full color emoji.
@mrobinson mrobinson force-pushed the macos-color-fonts branch from 90c5a26 to b1f5b47 Compare May 1, 2024 12:25
synthesized_small_caps,
)?)))
)?;
font.font_key = self.font_source.get_font_instance(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are first instantiating the Font with the default FontInstanceKey and then overriding it again with a valid one - is this because the a Font instance is needed to first get the flags to be passed to WebRender in order to get the key from it?

In the future and not necessarily in this same PR, would it be possible to get the flags from the template instead of the Font instance?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be hard to get this from the FontTemplate, but there's a possibility that we could create the PlatformFont first and get it from there. The other option is we could move the FontInstanceKey out of the font or make it an Option. There could conceivably be some cases where we want to keep the font cached, but also not have it in WebRender.

@mrobinson mrobinson added this pull request to the merge queue May 2, 2024
Merged via the queue into servo:main with commit 9282145 May 2, 2024
@mrobinson mrobinson deleted the macos-color-fonts branch May 2, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants