[Bug 3512] Implement font-stretch property

bugzilla-daemon at mozilla.org bugzilla-daemon at mozilla.org
Wed Jan 28 18:58:08 UTC 2009


Do not reply to this email.  You can add comments to this bug at
https://bugzilla.mozilla.org/show_bug.cgi?id=3512


Boris Zbarsky (:bz) (todo: 175+ items) <bzbarsky at mit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #358121|superreview?(bzbarsky at mit.e |superreview+
               Flag|du)                         |




--- Comment #58 from Boris Zbarsky (:bz) (todo: 175+ items) <bzbarsky at mit.edu>  2009-01-28 10:58:00 PST ---
(From update of attachment 358121)
>+++ b/gfx/src/nsFont.cpp
> nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,

Might be worth it to move these constructors to initializer syntax, maybe. 
That can be a separate patch, of course.

>+++ b/gfx/thebes/public/gfxFontConstants.h

>+#define NS_FONT_STRETCH_ULTRA_CONDENSED -4
>+#define NS_FONT_STRETCH_EXTRA_CONDENSED -3
>+#define NS_FONT_STRETCH_CONDENSED       -2
>+#define NS_FONT_STRETCH_SEMI_CONDENSED  -1
>+#define NS_FONT_STRETCH_NORMAL          0
>+#define NS_FONT_STRETCH_SEMI_EXPANDED   1
>+#define NS_FONT_STRETCH_EXPANDED        2
>+#define NS_FONT_STRETCH_EXTRA_EXPANDED  3
>+#define NS_FONT_STRETCH_ULTRA_EXPANDED  4
>+#define NS_FONT_STRETCH_WIDER           10
>+#define NS_FONT_STRETCH_NARROWER        -10

Document or PR_STATIC_ASSERT that WIDER needs to be > ULTRA_EXPANDED -
ULTRA_CONDENSED (or rather the min and max "normal" values of font-stretch) and
that NARROWER needs to be -WIDER?  I assume it does so that we can tell apart
ULTRA_CONDENSED+WIDER and other values.

>+++ b/layout/style/nsComputedDOMStyle.cpp
>+nsComputedDOMStyle::GetFontStretch(nsIDOMCSSValue** aValue)
>+  PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER == -10);
>+  PR_STATIC_ASSERT(NS_FONT_STRETCH_WIDER == 10);

How about:

  PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER % 2 == 0);
  PR_STATIC_ASSERT(NS_FONT_STRETCH_WIDER % 2 == 0);

>+  } else if (stretch <= -5) {
...
>+  } else if (stretch >= 5) {

And make that |stretch <= NS_FONT_STRETCH_NARROWER / 2| and |stretch >=
NS_FONT_STRETCH_WIDER / 2| ?  That looks like it should be eqivalent given the
range asserts in the header, right?

Alternately, if we had a FONT_STRETCH_MIN/MAX declared in the header we could
compare to them here (with strict < and >, presumably).

sr=bzbarsky with the nits.

-- 
Configure bugmail: https://bugzilla.mozilla.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.




More information about the fonts-bugs mailing list