Skip to content

fonts: Merge multiple methods into PlatformFont::descriptor() - #32115

Merged
mukilan merged 1 commit into
servo:mainfrom
mrobinson:platformfont-descriptor
Apr 23, 2024
Merged

mukilan merged 1 commit into
servo:mainfrom
mrobinson:platformfont-descriptor

Conversation

@mrobinson

@mrobinson mrobinson commented Apr 19, 2024 •

Copy link
Copy Markdown
Member

This combines style(), boldness(), stretchiness() into a
descriptor() method which is used when creating FontTemplates for
web fonts. Eventually this method will simply read font tables using
skrifa. This is the first step.

In addition, family_name() and face_name() are removed. They were
only used for debugging and the FontIdentifier serves for that. On
Windows, this was adding another way in which font loading could fail,
without buying us very much. The path or URL to the font is more
important when debugging than the names in the font tables.

Closes #15103.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes do not require tests because they should not change observable behavior.

@mrobinson mrobinson added the T-full Do a full try run label Apr 19, 2024
@github-actions github-actions Bot removed the T-full Do a full try run label Apr 19, 2024
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#8756343927) for Linux WPT, MacOS, Windows, Android

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#8756343927) failed.

@mrobinson
mrobinson force-pushed the platformfont-descriptor branch from d8c555e to f6abbed Compare April 19, 2024 17:13
@mrobinson mrobinson added the T-full Do a full try run label Apr 19, 2024
@github-actions github-actions Bot removed the T-full Do a full try run label Apr 19, 2024
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#8757216594) for Linux WPT, MacOS, Windows, Android

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt-layout-2013 from try job (#8757216594):

Flaky unexpected result (17)
  • OK [expected CRASH] /_mozilla/mozilla/service-workers/service-worker-registration.https.html (#31036)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-uniform-packing-restrictions.html (#28103)
    • NOTRUN [expected PASS] subtest: Overall test
  • OK /css/cssom-view/offsetTopLeft-border-box.html (#24237)
    • FAIL [expected PASS] subtest: container: 0

      assert_equals: offsetTop expected 2 but got 0
      

    • FAIL [expected PASS] subtest: container: 1

      assert_equals: offsetTop expected 2 but got 0
      

  • TIMEOUT /fetch/fetch-later/new-window.tentative.https.window.html (#32036)
    • TIMEOUT [expected FAIL] subtest: A same-origin window[target=''][features='0'] can trigger fetchLater.

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: A same-origin window[target=''][features='1'] can trigger fetchLater.

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: A same-origin window[target=''][features='2'] can trigger fetchLater.

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: A same-origin window[target='_blank'][features='0'] can trigger fetchLater.

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: A same-origin window[target='_blank'][features='1'] can trigger fetchLater.

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: A same-origin window[target='_blank'][features='2'] can trigger fetchLater.

      Test timed out
      

  • TIMEOUT /fetch/metadata/generated/css-images.sub.tentative.html (#29047)
    • TIMEOUT [expected PASS] subtest: background-image sec-fetch-site - HTTPS downgrade (header not sent)

      Test timed out
      

  • OK /fetch/private-network-access/worker-blob-fetch.tentative.window.html (#30064)
    • PASS [expected FAIL] subtest: treat-as-public to public: success.
  • TIMEOUT [expected OK] /html/browsers/history/the-history-interface/traverse_the_history_write_onload_1.html (#21581)
    • TIMEOUT [expected PASS] subtest: Traverse the history when a history entry is written in the load event

      Test timed out
      

  • OK [expected TIMEOUT] /html/infrastructure/urls/base-url/document-base-url-window-initiator-is-not-opener.https.window.html (#30970)
  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
    • FAIL [expected NOTRUN] subtest: Check that popups from a sandboxed iframe do not escape the sandbox

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK [expected TIMEOUT] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • PASS [expected TIMEOUT] subtest: reparent-form-during-planned-navigation-task
  • OK /html/semantics/forms/form-submission-0/text-plain.window.html (#28687)
    • PASS [expected FAIL] subtest: text/plain: 0x00 in filename (formdata event)
    • PASS [expected FAIL] subtest: text/plain: single quote in value (normal form)
  • TIMEOUT [expected OK] /html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html (#25805)
    • TIMEOUT [expected FAIL] subtest: Fulfillment handler on pending-then-fulfilled promise

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: Rejection handler on pending-then-rejected promise

      Test timed out
      

  • TIMEOUT [expected OK] /html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html (#25805)
    • TIMEOUT [expected FAIL] subtest: Fulfillment handler on pending-then-fulfilled promise

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: Rejection handler on pending-then-rejected promise

      Test timed out
      

  • TIMEOUT [expected OK] /wasm/jsapi/functions/entry.html (#27087)
    • TIMEOUT [expected FAIL] subtest: Start function

      Test timed out
      

  • TIMEOUT [expected OK] /webmessaging/without-ports/017.html (#24486)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, about:blank

      Test timed out
      

  • TIMEOUT [expected OK] /webmessaging/without-ports/018.html (#24485)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, javascript:

      Test timed out
      

  • OK [expected ERROR] /workers/constructors/Worker/Worker-constructor.html (#22991)
Stable unexpected results that are known to be intermittent (9)
  • OK /css/cssom-view/MediaQueryList-addListener-removeListener.html (#24569)
    • FAIL [expected PASS] subtest: listeners are called correct number of times

      assert_equals: expected 1 but got 0
      

  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-referrer.window.html (#29081)
    • PASS [expected TIMEOUT] subtest: no-referrer referrer policy used to create the starting page
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin-fragment.html (#20768)
    • PASS [expected FAIL] subtest: Tests that a fragment navigation in the unload handler will not block the initial navigation
  • OK /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/a-click.html (#28697)
    • PASS [expected FAIL] subtest: aElement.click() before the load event must NOT replace
  • OK [expected TIMEOUT] /html/semantics/embedded-content/media-elements/track/track-element/no-cuechange-before-play.html (#31014)
    • FAIL [expected TIMEOUT] subtest: Ensure that the 'cuechange' event is not fired before video playback has begun.

      assert_true: Not expecting event, but got canplaythrough event expected true got false
      

  • OK /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
  • TIMEOUT /resource-timing/test_resource_timing.html (#25720)
    • FAIL [expected PASS] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)

      assert_equals: expected 4851200 but got 4850688
      

  • TIMEOUT [expected OK] /webmessaging/with-ports/017.html (#24486)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, about:blank

      Test timed out
      

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt-layout-2020 from try job (#8757216594):

Flaky unexpected result (23)
  • CRASH [expected PASS] /_webgl/conformance/glsl/bugs/nested-functions-should-not-crash.html (#30680)
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • PASS [expected FAIL] subtest: Matching font-weight: '400' should prefer '501 550' over '502 560'
    • PASS [expected FAIL] subtest: Matching font-weight: '500' should prefer '450 460' over '400'
    • PASS [expected FAIL] subtest: Matching font-weight: '399' should prefer '500 501' over '502 510'
    • PASS [expected FAIL] subtest: Matching font-stretch: '90%' should prefer '60% 70%' over '110% 140%'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 0deg' should prefer 'oblique 0deg' over 'oblique 5deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 0deg' should prefer 'oblique 5deg' over 'oblique 15deg 20deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique -10deg' should prefer 'oblique 0deg 10deg' over 'oblique 40deg 50deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique -21deg' should prefer 'oblique -10deg' over 'italic'
  • OK /css/cssom-view/MediaQueryList-addListener-removeListener.html (#24569)
    • FAIL [expected PASS] subtest: listeners are called correct number of times

      assert_equals: expected 6 but got 5
      

    • FAIL [expected PASS] subtest: listeners are called in order they were added

      assert_array_equals: lengths differ, expected array ["1st", "2nd"] length 2, got [] length 0
      

  • OK /css/cssom-view/MediaQueryList-extends-EventTarget-interop.html (#25285)
    • FAIL [expected PASS] subtest: listener added with addListener and addEventListener (capture) is called twice

      assert_equals: triggerMQLEvent expected 2 but got 0
      

  • OK /custom-elements/form-associated/ElementInternals-setFormValue.html (#29174)
    • PASS [expected FAIL] subtest: Single value - empty name exists
    • PASS [expected FAIL] subtest: Null value should submit nothing
  • TIMEOUT /fetch/api/basic/keepalive.any.html (#29536)
    • TIMEOUT [expected PASS] subtest: [keepalive] simple GET request on 'load' [no payload]; setting up

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: [keepalive] simple GET request on 'pagehide' [no payload]; setting up
  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.https.sub.html (#30111)
    • FAIL [expected TIMEOUT] subtest: sec-fetch-site - Cross-site, no attributes

      promise_test: Unhandled rejection with value: object "Error: Failed to query for recorded headers."
      

    • TIMEOUT [expected NOTRUN] subtest: sec-fetch-site - Same site, no attributes

      Test timed out
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigate-to-unparseable-url.html (#29050)
    • PASS [expected FAIL] subtest: <a> tag navigate fails for unparseable URLs
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-cross-origin.sub.window.html (#29056)
    • FAIL [expected PASS] subtest: Cross-origin navigation started from unload handler must be ignored

      promise_test: Unhandled rejection with value: object "SecurityError: The operation is insecure."
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • PASS [expected FAIL] subtest: Same-origin navigation started from unload handler must be ignored
  • OK /html/browsers/history/the-history-interface/traverse_the_history_3.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • OK /html/browsers/history/the-history-interface/traverse_the_history_4.html (#21383)
    • FAIL [expected PASS] subtest: Multiple history traversals, last would be aborted

      assert_array_equals: Pages opened during history navigation expected property 1 to be 5 but got 3 (expected array [6, 5] got [6, 3])
      

  • OK [expected CRASH] /html/browsers/windows/embedded-opener-remove-frame.html (#23867)
    • FAIL [expected TIMEOUT] subtest: opener of discarded auxiliary browsing context

      assert_object_equals: property "get" expected function "function opener() {
          [native code]
      }" got function "function opener() {
          [native code]
      }"
      

  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • FAIL [expected NOTRUN] subtest: Check that popups from a sandboxed iframe do not escape the sandbox

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK /html/semantics/embedded-content/the-img-element/non-active-document.html (#21544)
    • FAIL [expected PASS] subtest: DOMParser

      assert_unreached: got unexpected load event Reached unreachable code
      

    • FAIL [expected PASS] subtest: createHTMLDocument

      assert_unreached: got unexpected error event Reached unreachable code
      

    • FAIL [expected PASS] subtest: <template>

      assert_unreached: got unexpected error event Reached unreachable code
      

  • OK [expected TIMEOUT] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • PASS [expected TIMEOUT] subtest: reparent-form-during-planned-navigation-task
  • TIMEOUT [expected CRASH] /html/webappapis/dynamic-markup-insertion/opening-the-input-stream/ignore-opens-during-unload.window.html (#21444)
  • TIMEOUT /resource-timing/test_resource_timing.https.html (#25216)
    • FAIL [expected PASS] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)

      assert_equals: expected 3382272 but got 3382528
      

  • OK [expected TIMEOUT] /webmessaging/without-ports/017.html (#24486)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, about:blank
  • OK [expected TIMEOUT] /webmessaging/without-ports/018.html (#24485)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, javascript:
  • TIMEOUT [expected OK] /webstorage/localstorage-about-blank-3P-iframe-opens-3P-window.partitioned.tentative.html (#29053)
    • TIMEOUT [expected PASS] subtest: StorageKey: test 3P about:blank window opened from a 3P iframe

      Test timed out
      

  • OK /xhr/open-url-multi-window-5.htm (#23360)
    • FAIL [expected PASS] subtest: XMLHttpRequest: open() resolving URLs (multi-Window; 5)

      assert_throws_dom: function "function() {client.open("GET", "...") }" did not throw
      

Stable unexpected results that are known to be intermittent (10)
  • FAIL [expected PASS] /_mozilla/css/dirty_viewport.html (#13731)
  • FAIL [expected PASS] /_mozilla/mozilla/iframe/resize_after_load.html (#13573)
  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.sub.html (#30111)
    • TIMEOUT [expected FAIL] subtest: sec-fetch-site - Not sent to non-trustworthy same-site destination, no attributes

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: sec-fetch-site - Not sent to non-trustworthy cross-site destination, no attributes
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • FAIL [expected PASS] subtest: load & pageshow events do not fire on contentWindow of <iframe> element created with src=''

      assert_unreached: load should not be fired Reached unreachable code
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/a-click.html (#28697)
    • FAIL [expected PASS] subtest: aElement.click() before the load event must NOT replace

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?thereplacement" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/resources/code-injector.html?pipe=sub(none)&code=%0A%20%20%20%20const%20a%20%3D%20document.createElement(%22a%22)%3B%0A%20%20%20%20a.href%20%3D%20%22%2Fcommon%2Fblank.html%3Fthereplacement%22%3B%0A%20%20%20%20document.currentScript.before(a)%3B%0A%20%20%20%20a.click()%3B%0A%20%20"
      

  • OK /html/browsers/history/the-history-interface/traverse_the_history_5.html (#21383)
    • FAIL [expected PASS] subtest: Multiple history traversals, last would be aborted

      assert_array_equals: Pages opened during history navigation expected property 1 to be 5 but got 3 (expected array [6, 5] got [6, 3])
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/media-elements/video_loop_base.html (#31590)
    • NOTRUN [expected PASS] subtest: Check if video.loop is set to true that expecting the seeking event is fired more than once
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
  • TIMEOUT [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
    • NOTRUN [expected FAIL] subtest: Check that popups from a sandboxed iframe do not escape the sandbox
  • OK /html/webappapis/dynamic-markup-insertion/document-write/module-static-import-delayed.html (#26243)
    • PASS [expected FAIL] subtest: document.write in an imported module

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#8757216594) failed.

@mrobinson
mrobinson requested a review from mukilan April 19, 2024 18:15
@mrobinson

Copy link
Copy Markdown
Member Author

@mukilan This is a another cleanup on top of the work we have done to streamline the font loading code.

@mrobinson
mrobinson force-pushed the platformfont-descriptor branch from f6abbed to fbbff12 Compare April 19, 2024 18:20
@mrobinson mrobinson added the T-windows Do a try run on Windows label Apr 19, 2024
@github-actions github-actions Bot removed the T-windows Do a try run on Windows label Apr 19, 2024
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#8757947457) for Windows

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#8757947457) failed.

@mrobinson
mrobinson force-pushed the platformfont-descriptor branch from fbbff12 to c11f20a Compare April 20, 2024 07:53
@mrobinson mrobinson added the T-windows Do a try run on Windows label Apr 20, 2024
@github-actions github-actions Bot removed the T-windows Do a try run on Windows label Apr 20, 2024
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#8764762028) for Windows

@github-actions

Copy link
Copy Markdown

✨ Try run (#8764762028) succeeded.

@mrobinson
mrobinson force-pushed the platformfont-descriptor branch from c11f20a to a03de35 Compare April 22, 2024 07:02
This combines `style()`, `boldness()`, `stretchiness()` into a
`descriptor()` method which is used when creating `FontTemplate`s for
web fonts. Eventually this method will simply read font tables using
skrifa. This is the first step.

In addition, `family_name()` and `face_name()` are removed. They were
only used for debugging and the `FontIdentifier` serves for that. On
Windows, this was adding another way in which font loading could fail,
without buying us very much. The path or URL to the font is more
important when debugging than the names in the font tables.
@mrobinson
mrobinson force-pushed the platformfont-descriptor branch from a03de35 to 88fd4b8 Compare April 23, 2024 08:22
@mrobinson
mrobinson marked this pull request as ready for review April 23, 2024 08:23
@mrobinson

mrobinson commented Apr 23, 2024 •

Copy link
Copy Markdown
Member Author

This one should be ready to review now.

@mukilan
mukilan added this pull request to the merge queue Apr 23, 2024
Merged via the queue into servo:main with commit de47dfe Apr 23, 2024
@mrobinson
mrobinson deleted the platformfont-descriptor branch June 1, 2024 09:55
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.

Windows downloadable font support may need some fleshing out

2 participants