fonts: Use fontations to read the OS/2 table of DirectWrite fonts (#38851)

Instead of copying the font table data in memory and parsing it with the
`truetype` crate, use a non-copying API from DirectWrite to implement a
`fontations` `TableProvider`. This has two benefits:

- We remove the dependency on the `truetype` crate finally.
- We do not have to make an in-memory copy of the table data when
  parsing the table.

The hope is that the `TableProvider` will be more generally useful in
the future.

Testing: There are no automated tests for Windows, but I manually
verified
that the data retrived via `fontations` matched that retrived by
`truetype`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-08-22 09:23:35 -07:00 committed by GitHub
parent 176e42d36d
commit 777373054f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 107 additions and 116 deletions

View file

@ -74,7 +74,7 @@ xml-rs = "0.8"
[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.11.4"
truetype = { version = "0.47.3", features = ["ignore-invalid-language-ids"] }
winapi = { workspace = true }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ohos_mock)'] }