Details
-
Task
-
Resolution: Done
-
P2: Important
-
5.15, 6.0.0
-
None
-
-
89a703dcb8 (qt/qtbase/dev) 89a703dcb8 (qt/tqtc-qtbase/dev)
Description
What is the benefit? Why is this valuable?
Today, Qt applications built for WebAssembly are not able to access locally installed fonts, and must instead embed font files as application resources. Qt ships one or two default fonts.
This is not ideal for several reasons: the user may want to use a different font face, and expects that locally installed fonts are available. The default-shipped fonts have limited character coverage.
There are a couple of options to improve the situation:
** Add support for web fonts. The application developer could then declare which fonts to use, and qtloader.js will download the font files at startup, either from fonts.google.com or from the app web server.
** Use Web API which gives Qt access to the font data. Such API is being developed, at least for Chrome. See technical section below
What are common use cases?
Allows WebAssembly users to employ different fonts and characters.
Technical information
Font API for Chrome:
[[[https://bugs.chromium.org/p/chromium/issues/detail?id=535764]|https://bugs%5C.chromium%5C.org/p/chromium/issues/detail?id=535764%5C%5D%5C%5D%7Chttps://bugs%5C%5C.chromium%5C%5C.org/p/chromium/issues/detail?id=535764%5C%5D%5C%5D%5C%5D|https://bugs%5C\.chromium%5C\.org/p/chromium/issues/detail?id=535764%5C%5D%5C%5D]]
[[[https://bugs.chromium.org/p/chromium/issues/detail?id=982054]|https://bugs%5C.chromium%5C.org/p/chromium/issues/detail?id=982054%5C%5D%5C%5D%7Chttps://bugs%5C%5C.chromium%5C%5C.org/p/chromium/issues/detail?id=982054%5C%5D%5C%5D%5C%5D|https://bugs%5C\.chromium%5C\.org/p/chromium/issues/detail?id=982054%5C%5D%5C%5D]]
[[[https://github.com/slightlyoff/local_font_access]|https://github%5C.com/slightlyoff/local%5C_font%5C_access%5C%5D%5C%5D%7Chttps://github%5C%5C.com/slightlyoff/local%5C%5C_font%5C%5C_access%5C%5D%5C%5D%5C%5D|https://github%5C\.com/slightlyoff/local%5C_font%5C_access%5C%5D%5C%5D]]
Edit 1: more recent docs https://docs.google.com/document/d/1BIMWgjDX1tEHpDV-vPNv8pMx9VtKchF3FM-mJgWVAfc/edit
Edit 2: another "recent" useful blog with code examples (they have to be slightly modified) https://web.dev/local-fonts/
Edit 3: Mozilla's position on Local Font Access API https://github.com/mozilla/standards-positions/issues/401
Edit 4: Local Fonts Access was added in Chrome 103 https://chromestatus.com/feature/6234451761692672
Related gerrit merge requests:
freetype: Propagate font data from font database to engine if available https://codereview.qt-project.org/c/qt/qtbase/+/420314
Emit QGuiApplication::fontDatabaseChanged() when platform fonts are added https://codereview.qt-project.org/c/qt/qtbase/+/420315
Don't assume that QtFontFamily::ensurePopulated() will populate https://codereview.qt-project.org/c/qt/qtbase/+/425752
Attachments
Issue Links
- blocks
-
QTBUG-100127 Official WebAssembly Support
- Closed
- mentioned in
-
Page Loading...