Bug 1938548 - Handle CFF2 in UnscaledFontMac::GetFontFileData. a=RyanVM

Original Revision: https://phabricator.services.mozilla.com/D232808

Differential Revision: https://phabricator.services.mozilla.com/D232904
This commit is contained in:
Jonathan Kew 2025-01-11 02:15:44 +00:00
parent d574cf55f1
commit d6b4284438
4 changed files with 29 additions and 2 deletions

View file

@ -290,7 +290,7 @@ bool UnscaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback,
bool CFF = false;
for (CFIndex i = 0; i < count; i++) {
uint32_t tag = (uint32_t)(uintptr_t)CFArrayGetValueAtIndex(tags, i);
if (tag == 0x43464620) { // 'CFF '
if (tag == 0x43464620 || tag == 0x43464632) { // 'CFF ', 'CFF2'
CFF = true;
}
CFDataRef data = CGFontCopyTableForTag(mFont, tag);

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<meta charset="utf-8">
<style>
@font-face {
font-family: test;
/* WhiteOnBlack CFF2 font from https://github.com/adobe-fonts/white-on-black-vf,
licensed under the SIL Open Font License version 1.1 */
src: url(WhiteOnBlack.otf);
}
div {
font: 40px test;
}
</style>
<div>&#x328E;</div>
<canvas id="c"></canvas>
<script>
document.fonts.ready.then(() => {
var ctx = document.getElementById("c").getContext("2d");
ctx.font = "40px test";
ctx.fillText("\u328E", 0, 100);
});
</script>

Binary file not shown.

View file

@ -225,4 +225,4 @@ load 1825450.html
load 1683679.html
load 1843622.html
load 1898569.html
load 1938548.html