Closed Bug 1020143 Opened 10 years ago Closed 10 years ago

Number labels in <li> aren't forced to be fixed-width (tabular), which means lists look gross in Fira Sans

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: dholbert, Assigned: jfkthame)

Details

Attachments

(3 files, 1 obsolete file)

Attached file testcase 1
STR:
 1. Load attached testcase (which has Fira Sans Regular included as a data-URI-encoded WOFF file)
 2. Look at adjacent lines for e.g. "17" and "18", and "20" vs "21".

ACTUAL RESULTS: The numbers are proportional-width, which makes them misaligned between lines, and which makes the list look jagged/bumpy.

EXPECTED RESULTS: Numbers should be aligned between consecutive lines in the list.

This is what lists look like on B2G, since this is the default font on B2G. This seems to be due to a quirk of the font.

jdaggett says in IRC:
{
 could make them be the tabular ones
 in the font
 or....
 add font-variant-numeric:tabular-nums; to the default stylesheet for <li>
}
Component: Layout → Layout: Text
Simple solution is to force on tabular numbers for <li> numbers in the user-agent stylesheet:

  li::-moz-list-number { font-feature-settings: "tnum" on; }

This will force on the use of tabular digits in ordered lists.

However, I think there's probably a larger issue for the UI in general, are default proportional digits the better choice for the default font?  Put another way, are there other cases in B2G content where this adversely affects the user experience?  This is a UI-team call I think.
I think we should go ahead and add this to ua.css in any case; it'll be an improvement in the default behavior for other fonts that may default to proportional digits, too, so even if we decide to switch the default in Fira Sans, it's still good to include this in the stylesheet.
Attachment #8433979 - Flags: review?(dholbert)
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
(In reply to John Daggett (:jtd) from comment #2)
> However, I think there's probably a larger issue for the UI in general, are
> default proportional digits the better choice for the default font?  Put
> another way, are there other cases in B2G content where this adversely
> affects the user experience?  This is a UI-team call I think.

That's a fair question. cc'ing Patryk for any thoughts on this.
Comment on attachment 8433979 [details] [diff] [review]
prefer tabular numerals for list numbering.

> *|*::-moz-list-bullet, *|*::-moz-list-number {
>   display: inline;
>   vertical-align: baseline;
>+  -moz-font-variant-numeric: tabular-nums;
>+  font-variant-numeric: tabular-nums;
> }

Why use the -moz prefixed version alongside the (supported) unprefixed version? I'd rather we just use one decl here.

Punting to jdaggett, because I only learned about this property yesterday (from him), and I'm not sure about the merits of using this formulation vs. the  "font-feature-settings" version he posted in comment 2.
Attachment #8433979 - Flags: review?(dholbert) → review?(jdaggett)
A few things noticed in MXR:

(1) We don't ever use a prefixed version of the property name, so we probably should stick with that convention & not add a usage here (particularly because I see no benefit to doing so):
 http://mxr.mozilla.org/mozilla-central/search?string=moz-font-variant-numeric

(2) This property is currently preffed *off* in release builds.  So for this to help there, we need to get it preffed on (in release builds generally, or at least just in Firefox OS). Not sure what needs to be done for that to happen (i.e. what outstanding bugs there are) -- do you guys know?
 http://mxr.mozilla.org/mozilla-central/search?string=layout.css.font-features.enabled
You're right, I misremembered what we're doing here: I thought we currently had a prefixed version of -moz-font-variant-*, but we don't - that's only -moz-font-feature-settings.

I thought we had enabled the font-variant-* stuff on FirefoxOS; there are several existing uses of font-variant-numeric in the Gaia CSS files. Maybe that only works on dev builds, and will break when they go to release? :(
So here's a version that should actually work for both release and dev builds. Eventually we can migrate to just using font-variant-numeric, but for now this covers the various cases.
Attachment #8434229 - Flags: review?(jdaggett)
Attachment #8433979 - Attachment is obsolete: true
Attachment #8433979 - Flags: review?(jdaggett)
Comment on attachment 8434229 [details] [diff] [review]
prefer tabular numerals for list numbering.

We should probably raise a separate issue for the more general issue of proportional digits in the default font for B2G.
Attachment #8434229 - Flags: review?(jdaggett) → review+
Comment on attachment 8434229 [details] [diff] [review]
prefer tabular numerals for list numbering.

Maybe worth adding a comment that this should eventually switch to font-variant-numeric?
Oops - yes, that makes sense. (I'm mildly surprised that's the only test that failed, actually.) Simply adding the tnum feature to the reference should fix it, but I've pushed a try job to double-check: https://tbpl.mozilla.org/?tree=Try&rev=74b7037317b3.
https://hg.mozilla.org/mozilla-central/rev/e66a83f534b2
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
QA Whiteboard: [good first verify]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: