Bug 37451 - Web Inspector: Show Exact Font Being Used
Summary: Web Inspector: Show Exact Font Being Used
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 58079 134235 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-12 10:46 PDT by Joseph Pecoraro
Modified: 2016-12-13 15:35 PST (History)
16 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2010-04-12 10:46:00 PDT
From WebKit Contributors Meeting.
Comment 1 Trevor Downs 2011-02-20 05:43:15 PST
I was just about to file a bug for this myself.

I would like to see in the font list the font in use bolded or otherwise marked as to what is in use.

If a fallback is used I think next to the keyword the font should be listed in parentheses and italics. Possibly a lighter color as well?

So for example:

font-family: mycoolcustomfont, <b>Helvetica</b>, san-serif;
Since for whatever reason the first choice was not used and the second choice was, it is bolded to indicate the active typeface.

font-family: monotype<i>(Monaco)</i>;
The font here is one of the keyword fallbacks, so in this case it shows the fallback in italics.
Comment 2 Joseph Pecoraro 2013-08-30 11:03:55 PDT
I think Blink may have done this recently as well:
<https://chromium.googlesource.com/chromium/blink/+/a530760b6a7bb4b647e47a1cdcd40e890f2630cb>
Comment 3 Alexey Proskuryakov 2014-06-24 00:21:38 PDT
*** Bug 58079 has been marked as a duplicate of this bug. ***
Comment 4 Alexey Proskuryakov 2014-06-24 00:21:42 PDT
*** Bug 134235 has been marked as a duplicate of this bug. ***
Comment 5 Radar WebKit Bug Importer 2014-06-24 00:21:49 PDT
<rdar://problem/17431777>
Comment 6 Stefan Seiz 2016-04-29 06:41:45 PDT
IMHO, this is a much needed feature which both, FF and Chrome have already implemented. Any chance to see this in Safari/Webkit?

I second the idea to <bold> the font on the font list. Much preferred to the way e.g. Chrome does it, by displaying it below all the output in the "Computed" Tab.
Comment 7 Myles C. Maxfield 2016-04-29 20:30:28 PDT
(In reply to comment #6)
> IMHO, this is a much needed feature which both, FF and Chrome have already
> implemented. Any chance to see this in Safari/Webkit?
> 
> I second the idea to <bold> the font on the font list. Much preferred to the
> way e.g. Chrome does it, by displaying it below all the output in the
> "Computed" Tab.

This is an interesting idea.

In the WebKit inspector, you can only select an entire node at a time. How does it work in other browsers when certain characters in an element fall back to a different font than the rest of the characters?
Comment 8 Philippe Wittenbergh 2016-05-01 22:40:27 PDT
(In reply to comment #7)

> This is an interesting idea.

I still like the way Firefox (46) does it, a separate sub tab in the inspector.
(Weirdly perhaps, that sub tab does’t seem to exist in Firefox Developer edition and Firefox nightly)
 
> In the WebKit inspector, you can only select an entire node at a time. How
> does it work in other browsers when certain characters in an element fall
> back to a different font than the rest of the characters?

Speaking of Firefox: given this test file:
<!doctype html>
<body style="font-family: 'Helvetica Neue'; font-size: 2em;">

<p>test:☲ trigram</p>

<p style="font-family: Optima, sans-serif">test letters other ō ā</p>

Selecting any of the two <p>, the font sub tab shows the two font-family being used. For the 1st para, it shows 'Apple Symbols' and 'Helvetica Neue'; for the second one, it shows 'Optima' and 'Helvetica' (Optima doesn't have glyphs for ō ā).
Comment 9 Myles C. Maxfield 2016-05-02 16:27:06 PDT
(In reply to comment #8)
> (In reply to comment #7)
> 
> > This is an interesting idea.
> 
> I still like the way Firefox (46) does it, a separate sub tab in the
> inspector.
> (Weirdly perhaps, that sub tab does’t seem to exist in Firefox Developer
> edition and Firefox nightly)
>  
> > In the WebKit inspector, you can only select an entire node at a time. How
> > does it work in other browsers when certain characters in an element fall
> > back to a different font than the rest of the characters?
> 
> Speaking of Firefox: given this test file:
> <!doctype html>
> <body style="font-family: 'Helvetica Neue'; font-size: 2em;">
> 
> <p>test:☲ trigram</p>
> 
> <p style="font-family: Optima, sans-serif">test letters other ō ā</p>
> 
> Selecting any of the two <p>, the font sub tab shows the two font-family
> being used. For the 1st para, it shows 'Apple Symbols' and 'Helvetica Neue';
> for the second one, it shows 'Optima' and 'Helvetica' (Optima doesn't have
> glyphs for ō ā).

Ah, so it just presents the union of all the used fonts in the node.

Maybe that idea is enough for us. I'm not sure.
Comment 10 Myles C. Maxfield 2016-05-02 18:42:45 PDT
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > 
> > > This is an interesting idea.
> > 
> > I still like the way Firefox (46) does it, a separate sub tab in the
> > inspector.
> > (Weirdly perhaps, that sub tab does’t seem to exist in Firefox Developer
> > edition and Firefox nightly)
> >  
> > > In the WebKit inspector, you can only select an entire node at a time. How
> > > does it work in other browsers when certain characters in an element fall
> > > back to a different font than the rest of the characters?
> > 
> > Speaking of Firefox: given this test file:
> > <!doctype html>
> > <body style="font-family: 'Helvetica Neue'; font-size: 2em;">
> > 
> > <p>test:☲ trigram</p>
> > 
> > <p style="font-family: Optima, sans-serif">test letters other ō ā</p>
> > 
> > Selecting any of the two <p>, the font sub tab shows the two font-family
> > being used. For the 1st para, it shows 'Apple Symbols' and 'Helvetica Neue';
> > for the second one, it shows 'Optima' and 'Helvetica' (Optima doesn't have
> > glyphs for ō ā).
> 
> Ah, so it just presents the union of all the used fonts in the node.
> 
> Maybe that idea is enough for us. I'm not sure.

I think WebCore should expose something like (in pseudocode)

result: [range]
struct range {
    unsigned stringStartIndex
    unsigned stringEndIndex
    string font
}

Then, the web inspector machinery can determine the best way to expose this information to the user.