Closed Bug 1346261 Opened 7 years ago Closed 4 years ago

font-language-override value is not case-sensitive

Categories

(Core :: Graphics: Text, defect, P3)

52 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: corbett.dav, Assigned: jfkthame)

References

Details

(Whiteboard: [gfx-noted], [wptsync upstream])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170302120751

Steps to reproduce:

I installed FreeSerif and rendered:

data:text/html;charset=utf-8,<span style="font: 300px FreeSerif; font-language-override: 'trk'">fi


Actual results:

I saw the two separate letters “f” and “i”.


Expected results:

I should have seen a single “fi” ligature.

FreeSerif uses an “fi” ligature by default. It uses the TRK language system tag to disable the ligature. However, my example uses 'trk', not 'TRK'. 'trk' is not a valid language system tag. CSS Fonts 3 says that the value of font-language-override is a “single three-letter case-sensitive OpenType language system tag”. Therefore, 'trk' should be treated as an invalid tag, and the ligature should not be disabled.
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Component: CSS Parsing and Computation → Graphics: Text
Flags: needinfo?(jfkthame)
This seems to be a harfbuzz issue; such a tag ends up getting forced to uppercase here:
https://dxr.mozilla.org/mozilla-central/rev/4ceb9062ea8f4113bfd1b3536ace4a840a72faa7/gfx/harfbuzz/src/hb-ot-tag.cc#910

I'll raise this with Behdad and see what the thinking was here...
Flags: needinfo?(jfkthame)
Actually, on looking more closely, I think the real issue here is that the OpenType spec is a bit vague (and the current text in CSS Fonts 3 assumes an interpretation that may not be intended).

https://www.microsoft.com/typography/otspec/languagetags.htm says, of OpenType language system tags:

> As a general convention, capital letters (0x41 to 0x5A) are used.

but AFAICS it does not ever specify whether they are case sensitive or not. Given the parallels to ISO 639-* tags that are _not_ case sensitive, we might reasonably surmise that the OT tags are also case-insensitive. But it doesn't say so, one way or the other.
OpenType tags are meant to be case-sensitive. For example, https://www.microsoft.com/typography/OpenTypeDev/standard/intro.htm says:

> Note: both the script and language tags are case sensitive (script tags should be lowercase, language tags are all caps)
Priority: -- → P3
Whiteboard: [gfx-noted]

A version with the fix https://github.com/harfbuzz/harfbuzz/issues/2380 is released https://github.com/harfbuzz/harfbuzz/releases/tag/2.6.7 so maybe Mozilla is interested on pick it up

Bug 1643005 will update harfbuzz, which should resolve this.

I'll also add a simple testcase here, to verify that it is fixed.

Status: UNCONFIRMED → NEW
Depends on: 1643005
Ever confirmed: true
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

Note that prior to bug 1643005, one of the tests in the above patch will fail; but 1643005 has just landed, so all should now pass.

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ce88a648cfd3
Add some WPT reftests for font-language-override behavior. r=heycam
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/24111 for changes under testing/web-platform/tests
Whiteboard: [gfx-noted] → [gfx-noted], [wptsync upstream]
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: