Bug 1784910 - Render bitmap fonts as light-on-dark text. r=aosmond

When we are rendering dark-on-light text, we invert the bitmap after
rendering to produce a standard white-on-black mask, since we must actually
render that as black-on-white to get CoreText to produce the correct dilation.

However, when we know we're rendering bitmap fonts for emoji, we don't actually
want this inversion to happen at all. So we need to ensure bitmaps go through
the normal light-on-dark path that doesn't do this.

Differential Revision: https://phabricator.services.mozilla.com/D154777
This commit is contained in:
Lee Salzman
2022-08-16 16:49:10 +00:00
parent 6f4ccf70ca
commit aaca48b057

View File

@@ -2658,8 +2658,9 @@ bool DrawTargetWebgl::SharedContext::FillGlyphsAccel(
// dark-on-light, we may end up with different amounts of dilation applied, so
// we can't use the same mask in the two circumstances, or the glyphs will be
// dilated incorrectly.
bool lightOnDark = !useBitmaps && color.r >= 0.33f && color.g >= 0.33f &&
color.b >= 0.33f && color.r + color.g + color.b >= 2.0f;
bool lightOnDark =
useBitmaps || (color.r >= 0.33f && color.g >= 0.33f && color.b >= 0.33f &&
color.r + color.g + color.b >= 2.0f);
#else
// On other platforms, we assume no color-dependent dilation.
const bool lightOnDark = true;