Closed Bug 650372 Opened 15 years ago Closed 4 years ago

@font-face formats do not work without wrapping quotes

Categories

(Core :: Layout: Text and Fonts, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: me, Assigned: jfkthame)

References

Details

Attachments

(3 external files)

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27 Build Identifier: When defining an @font-face with multiple source files of different formats, Firefox fails to download and render the font unless the format() listed after the src url is wrapped in quotes. Reproducible: Always Steps to Reproduce: 1. Create @font-face definition with the following src property: src: url(../fonts/vimeo.eot) format(eot), url(../fonts/vimeo.woff) format(woff) 2. Reference the font in the css somewhere with a fallback font-family (like sans-serif) Actual Results: The font is rendered using the fallback. Expected Results: The font should be rendered with the referenced file. The spec (http://www.w3.org/TR/css3-fonts/#descdef-src) is silent on whether it requires quotes, but other browsers work without quotes.
Firefox behavior is correct according to the spec, AFAICS. The spec says that the format hint is a <string> (or a comma-separated list of <string>s): Name: src Value: [ <uri> [format(<string> [, <string>]*)] | <font-face-name> ] [, <uri> [format(<string> [, <string>]*)] | <font-face-name> ]* Initial: N/A And CSS syntax requires a <string> to be quoted; see http://www.w3.org/TR/css3-syntax/#tokenization.
Looks like you're right. Either way though, not wrapping in quotes still works in other browsers. IMHO, Firefox should work the same way.
Brad, it sounds like you want the spec changed. If so, I suggest mailing www-style@w3.org; at the moment it just looks like other browsers have buggy implementations.

In its most recent form, since July 2018 [1] the CSS Fonts level 4 spec does expect keywords or strings (strings likely for backwards compatibility).

May I nudge this issue? I am working on reliable feature detection for supported font formats and supported font technologies, in that sense arriving at better web compat for the format() stance and the " supports <font-technology>" stance would help a lot. Thanks for considering implementing parsing keywords correctly here and implementing throwing out unsupported entries instead of dropping the src: line as unparseable.

[1] https://github.com/w3c/csswg-drafts/commit/4d3684100754e06cf840a46b7d198df5066902dd

Depends on: 1784058

The CSS Fonts 4 spec requires this, and Safari (at least) has long supported it.

Depends on D154236

Assignee: nobody → jfkthame
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Now that the style system has keywords for this, we don't need to define them in gfx
but can just use the enum directly. (No functional change, just code simplification.)

Depends on D154237

Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e978496c7ea0 Accept keywords in addition to strings in the @font-face format() hint function. r=emilio https://hg.mozilla.org/integration/autoland/rev/eea47293ce56 Use the style-system format hint directly in gfx, instead of mapping to a separate internal enum. r=gfx-reviewers,aosmond,lsalzman https://hg.mozilla.org/integration/autoland/rev/c78a59ace7ec Fix legacy tests to account for keywords now being accepted. r=emilio

Backed out for causing reftest failures on variation-format-hint-1a.html

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: REFTEST TEST-UNEXPECTED-FAIL | layout/reftests/font-face/variation-format-hint-1a.html == layout/reftests/font-face/variation-format-hint-1A-ref.html | image comparison, max difference: 255, number of differing pixels: 2851
Flags: needinfo?(jfkthame)
Failed to create upstream wpt PR due to merge conflicts. This requires fixup from a wpt sync admin.
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8340c08ff8b6 Accept keywords in addition to strings in the @font-face format() hint function. r=emilio https://hg.mozilla.org/integration/autoland/rev/41d1c62f11ac Use the style-system format hint directly in gfx, instead of mapping to a separate internal enum. r=gfx-reviewers,aosmond,lsalzman https://hg.mozilla.org/integration/autoland/rev/2aa97ebc8593 Fix legacy tests to account for keywords now being accepted. r=emilio

Backed out for causing wpt failures on format-specifiers-variations.html.

Push with failures

Failure log

Also please take a look at this Tvw failure.

Backout link

[task 2022-08-11T19:40:28.010Z] 19:40:28     INFO - TEST-START | /css/css-fonts/format-specifiers-variations.html
[task 2022-08-11T19:40:28.023Z] 19:40:28     INFO - Closing window 0103ec62-616c-493b-954a-33164fc6586c
[task 2022-08-11T19:40:28.378Z] 19:40:28     INFO - 
[task 2022-08-11T19:40:28.378Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/font-variant-alternates-parsing.html | CSS Test:  font-variant-alternates: historical-forms; parses case-insensitively 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-FAIL | /css/css-fonts/font-variation-settings-serialization-001.html | font-feature-settings should be serialized to not include duplicates - assert_in_array: value "\"bldA\" 1, \"bldA\" 2" not in array ["\"bldA\" 2", "'bldA' 2"]
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - @http://web-platform.test:8000/css/css-fonts/font-variation-settings-serialization-001.html:19:32
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2590:25
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - test@http://web-platform.test:8000/resources/testharness.js:628:30
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - @http://web-platform.test:8000/css/css-fonts/font-variation-settings-serialization-001.html:18:17
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format woff 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format truetype 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format opentype 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format woff2 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format woff-variations 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format truetype-variations 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format opentype-variations 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-PASS | /css/css-fonts/format-specifiers-variations.html | Load Ahem with format woff2-variations 
[task 2022-08-11T19:40:28.379Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format xyzwoff - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.380Z] 19:40:28     INFO - 
[task 2022-08-11T19:40:28.380Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format xyztruetype - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.380Z] 19:40:28     INFO - 
[task 2022-08-11T19:40:28.380Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format xyzopentype - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.381Z] 19:40:28     INFO - 
[task 2022-08-11T19:40:28.381Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format xyzwoff2 - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.382Z] 19:40:28     INFO - 
[task 2022-08-11T19:40:28.382Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format xyzwoff-variations - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.383Z] 19:40:28     INFO - 
[task 2022-08-11T19:40:28.383Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format xyztruetype-variations - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.383Z] 19:40:28     INFO - 
<...>
[task 2022-08-11T19:40:28.409Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format opentye-variations - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.409Z] 19:40:28     INFO - 
[task 2022-08-11T19:40:28.409Z] 19:40:28     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/format-specifiers-variations.html | Do not load Ahem with format woff2variations - assert_unreached: Should have rejected: undefined Reached unreachable code
[task 2022-08-11T19:40:28.493Z] 19:40:28     INFO - TEST-OK | /css/css-fonts/format-specifiers-variations.html | took 482ms
[task 2022-08-11T19:40:29.216Z] 19:40:29     INFO - STDOUT: cleanup aborted: args: /builds/worker/fetches/android-sdk-linux/platform-tools/adb wait-for-device shell rm /data/data/org.mozilla.geckoview.test_runner/files/mozilla/profiles.ini; echo adb_returncode=$?, exitcode: 1, stdout: rm: /data/data/org.mozilla.geckoview.test_runner/files/mozilla/profiles.ini: No such file or directory
[task 2022-08-11T19:40:29.218Z] 19:40:29     INFO - Closing logging queue
[task 2022-08-11T19:40:29.218Z] 19:40:29     INFO - queue closed
[task 2022-08-11T19:40:29.233Z] 19:40:29     INFO - Setting up ssl
[task 2022-08-11T19:40:29.247Z] 19:40:29     INFO - certutil | b''
[task 2022-08-11T19:40:29.265Z] 19:40:29     INFO - certutil | b''
[task 2022-08-11T19:40:29.281Z] 19:40:29     INFO - certutil | b'\nCertificate Nickname                                         Trust Attributes\n                                                             SSL,S/MIME,JAR/XPI\n\nweb-platform-tests                                           CT,, \n'
[task 2022-08-11T19:40:34.663Z] 19:40:34     INFO - STDOUT: timed out waiting for profiles.ini
[task 2022-08-11T19:40:34.817Z] 19:40:34     INFO - adb Granting important runtime permissions to org.mozilla.geckoview.test_runner
[task 2022-08-11T19:40:36.399Z] 19:40:36     INFO - adb launch_application: am start -W -n org.mozilla.geckoview.test_runner/org.mozilla.geckoview.test_runner.TestRunnerActivity -a android.intent.action.MAIN --es env0 MOZ_CRASHREPORTER=1 --es env1 MOZ_CRASHREPORTER_NO_REPORT=1 --es env2 MOZ_CRASHREPORTER_SHUTDOWN=1 --es env3 MOZ_HIDE_RESULTS_TABLE=1 --es env4 MOZ_IN_AUTOMATION=1 --es env5 MOZ_LOG=signaling:3,mtransport:4,DataChannel:4,jsep:4 --es env6 R_LOG_LEVEL=6 --es env7 R_LOG_DESTINATION=stderr --es env8 R_LOG_VERBOSE=1 --es env9 MOZ_PROCESS_LOG=/tmp/tmpsnjkov21pidlog --es env10 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 --es env11 STYLO_THREADS=1 --es arg0 -no-remote --es arg1 -profile --es arg2 /data/local/tmp/test_root/profile --es arg3 --marionette --es arg4 about:blank --ez use_multiprocess True
[task 2022-08-11T19:40:37.523Z] 19:40:37     INFO - Starting runner
[task 2022-08-11T19:40:38.521Z] 19:40:38     INFO - TEST-START | /css/css-fonts/generic-family-keywords-001.html
Flags: needinfo?(jfkthame)
Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/db0298f08cc9 Accept keywords in addition to strings in the @font-face format() hint function. r=emilio https://hg.mozilla.org/integration/autoland/rev/23d26b5f07db Use the style-system format hint directly in gfx, instead of mapping to a separate internal enum. r=gfx-reviewers,aosmond,lsalzman https://hg.mozilla.org/integration/autoland/rev/940492468122 Fix legacy tests to account for keywords now being accepted. r=emilio
Flags: needinfo?(jfkthame)
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36028 for changes under testing/web-platform/tests
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: