Closed Bug 1452973 Opened 3 years ago Closed 3 years ago
_FONT _STRETCH _* constants to percentage-based values in preparation for CSS Fonts 4
Currently, we use constants in the range [-4 .. 4] to represent the 9 possible font-stretch values from ultra-condensed to ultra-expanded. However, CSS Fonts 4 updates font-stretch to accept not just the 9 enumerated values, but any non-negative percentage value (with the enumerated values mapping to percentages from ultra-condensed at 50% to ultra-expanded at 200%). In preparation for this, I propose revising the constants to values based on the CSS Fonts 4 percentage definitions. This allows us to make the necessary changes to the font-matching algorithm, and to begin mapping font-stretch values to the 'wdth' axis in OpenType variation fonts. (At this point, I'm leaving the stretch fields in gfxFontStyle, gfxFontEntry, etc as integers, to minimize risk in this bug. The next step, when parsing is updated to accept floating-point percentage values in addition to the enumerated values, will be to switch to a floating- or fixed-point representation for all the affected font properties -- stretch, weight, style.)
This is mostly trivial: change the definitions in gfxFontConstants.h, and switch font-stretch fields/variables from signed to unsigned now that they're always non-negative. The only other thing is a minor update to the font-matching code where it's computing "distance" between styles based on the constants. Tryserver says this doesn't break anything (at least not anything too obvious): https://treeherder.mozilla.org/#/jobs?repo=try&revision=654b6927ba0dc7dcd308067bc727bd24b3c1ea3f.
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Rebased this on top of the part-1 patch from bug 1436048.
Attachment #8967858 - Flags: review?(jwatt)
Comment on attachment 8967858 [details] [diff] [review] Update NS_FONT_STRETCH_* constants to values based on the percentage definitions in css fonts 4 Review of attachment 8967858 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/thebes/gfxDWriteCommon.h @@ +20,5 @@ > #include <windows.h> > #include <dwrite.h> > > static inline DWRITE_FONT_STRETCH > +DWriteFontStretchFromStretch(uint16_t aStretch) Might as well get rid of the trailing white space while you're here.
Attachment #8967858 - Flags: review?(jwatt) → review+
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/8b14b0ba94db Update NS_FONT_STRETCH_* constants to values based on the percentage definitions in css fonts 4. r=jwatt
You need to log in before you can comment on or make changes to this bug.