NEW286608
Display all the fonts used in a DOM node
https://bugs.webkit.org/show_bug.cgi?id=286608
Summary Display all the fonts used in a DOM node
Karl Dubost
Reported 2025-01-27 22:48:01 PST
Created attachment 474037 [details] testcase 1. Open the testcase.html with Safari on Desktop 2. Inspect the text 3. Go to the font Tab Expected: Display all the fonts being used Actual: Only the primary defined font is shown See how Firefox Devtools displays: * Helvetica * Hiragino Kaku Gothic ProN
Attachments
testcase (357 bytes, text/html)
2025-01-27 22:48 PST, Karl Dubost
no flags
rendering in safari, firefox (664.27 KB, image/jpeg)
2025-01-27 22:55 PST, Karl Dubost
no flags
Radar WebKit Bug Importer
Comment 1 2025-01-27 22:48:11 PST
Karl Dubost
Comment 2 2025-01-27 22:55:45 PST
Created attachment 474038 [details] rendering in safari, firefox Safari and Firefox with Web Inspector and Dev tools opened on the fonts tab.
Razvan Caliman
Comment 3 2025-01-28 07:36:48 PST
For clarification, when a font does not have all the necessary glyphs to render a piece of text, fallback fonts will be used for those missing glyphs, going through available fonts declared in `font-family` and down to the default fonts on the system. Web Inspector now shows just the "primary font" used to render that node's text: https://github.com/WebKit/WebKit/blob/b80a2ae51aaf378d3d1de94c0a857f48228ee7fb/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp#L609-L621 There's a getter for this primary font information in `FontCascade`: https://github.com/WebKit/WebKit/blob/845f0a548125461da779d734a84b15498a4538cb/Source/WebCore/platform/graphics/FontCascade.h#L384-L390 There's no explicit getter for fallback fonts. But a cursory look shows it might be possible to get that information by keeping records while going through `FontCascadeFonts::realizeFallbackRangesAt`: https://github.com/WebKit/WebKit/blob/845f0a548125461da779d734a84b15498a4538cb/Source/WebCore/platform/graphics/FontCascadeFonts.cpp#L198-L232
Karl Dubost
Comment 4 2025-01-29 16:47:23 PST
To note that this is essential to be able to investigate some webcompat issues related to fonts.
Note You need to log in before you can comment on or make changes to this bug.