Open Bug 1465026 Opened 7 years ago Updated 7 days ago

Font editor: values should be rounded

Categories

(DevTools :: Inspector, defect, P2)

defect

Tracking

(firefox134 fixed)

REOPENED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: mbalfanz, Assigned: leo)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Attached video accurate-values.mp4
Sometimes, fields that have valid values are marked as red. When the sliders are then used, the resulting values have an unusable amount of decimals. STR: 1. Go to v-fonts.com 2. Search for the font "Skia" (last on page) and inspect it 3. Adjust the axis Expected result: - Sliders are not marked in red as initial values are valid - When sliders are moved, the set values have a usable accuracy (like 2) Actual result: - Initial values are marked with red border, even though "1" is a valid value - When moving the sliders, it fills 15 decimals even though only the first 2 are actually changed
Actually, I noticed another problem with this: Apparently Skia supports font-weight values of 0.48 - 3.2. This range doesn't make much sense (and yields the wrong results) as a value of the font-weight property, and should probably stay within font-variation-settings. For width, it's equally confusing (and potentially wrong, as font-stretch expects percentages).
As Skia is a system font on OS X, here is a simple test case regarding the last comment: data:text/html,<style>body{font-family: Skia}</style><p>Lorem ipsum The font accepts the font-weight property with values in the hundreds (400, 600 etc.) However, the variable weight axis expects of 0.48 - 3.2 The editor writes those values to font-weight, and therefore giving the unexpected result.
Skia is a legacy macOS font where the scales used for the "width" and "weight" axes are quite different from the CSS font-weight/font-stretch scales. Within the platform code, we don't attempt to map the high-level properties (width, stretch) to the variation axes in a font like this; the variations can only be managed directly via font-variation-settings.
Assignee: nobody → rcaliman
Status: NEW → ASSIGNED
Product: Firefox → DevTools
Assignee: rcaliman → nobody
Status: ASSIGNED → NEW
Summary: Values should be rounded → Font editor: values should be rounded
Blocks: 1280059
No longer blocks: 1441576
Carried over from Bug 1489479: limit precision to three decimals.
Component: Inspector: Fonts → Inspector
Severity: normal → S3

I can start on rounding the precision to three decimals. Could this be assigned to me please?

Assignee: nobody → AAR.dev
Status: NEW → ASSIGNED

Quick question on how to deal with a certain scenario.

The user can edit an html element in the inspector. This updates the font value and does not round it to three decimals. Do we want it to round instantly? I think it should be left exact if the user edited the html.

Attachment #9436617 - Attachment description: Bug 1465026 - Font properties are rounded in the inspector. r?jdescottes → Bug 1465026 - Font properties are rounded in the inspector. r?jdescottes The toFixed function in font utils now throws an error when the input is not a number
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1f59c00e7b80 Font properties are rounded in the inspector. r=jdescottes,devtools-reviewers The toFixed function in font utils now throws an error when the input is not a number
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
Flags: qe-verify+
Attached image 1465026.gif

Hello! I reproduced the issue with Firefox 134.0a1 (2024-11-18) on Windows 10x64. After following the steps from comment 0 and moving the slider for the Weight and Width options the values have more than 3 decimals while the slider is moved and after the selection is confirmed.
The issue is verified fixed with 134.0b4 on Windows 10x64, macOS 12, and Ubuntu 24. After moving the slider for the Weight and Width options, only 3 decimals are displayed. However, while the slider is moved, more than 3 decimals are displayed (see screen recording). Is this expected? Also is there anything else that we should verify for this issue? Thank you!

Flags: needinfo?(AAR.dev)

(In reply to Alexandru Trif, Desktop Test Engineering [:atrif] [PTO 1-2 May] from comment #11)

Created attachment 9441326 [details]
1465026.gif

Hello! I reproduced the issue with Firefox 134.0a1 (2024-11-18) on Windows 10x64. After following the steps from comment 0 and moving the slider for the Weight and Width options the values have more than 3 decimals while the slider is moved and after the selection is confirmed.
The issue is verified fixed with 134.0b4 on Windows 10x64, macOS 12, and Ubuntu 24. After moving the slider for the Weight and Width options, only 3 decimals are displayed. However, while the slider is moved, more than 3 decimals are displayed (see screen recording). Is this expected? Also is there anything else that we should verify for this issue? Thank you!

Thank you for finding this. I am able to reproduce this on Linux 137.0. It only happens on certain fonts such as Skia, as you demonstrated. I am too busy to commit a patch currently, so I cannot immediately jump into the code and try to resolve this. But I can confirm that this is reproducible.

Status: RESOLVED → REOPENED
Flags: needinfo?(AAR.dev)
Resolution: FIXED → ---
Assignee: AAR.dev → lmcardle
See Also: → 2013940
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: