You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2017/03/03 05:45:26 UTC

[Flex JS] Font weight issues

Hi,

Just a FYI in case this trips anyone else up.

The code in applyStyle in SimpleCSSValuesImpl assumes that most CSS style numbers are pixels - this is not be the case.

The code in questions is:
if (typeof(value) == 'number') {
    if (colorStyles[p])
        value = CSSUtils.attributeFromColor(value);
    else
        value = value.toString() + 'px';
}

Which for font-weight means you can't use values 100,200,300,400,500,600,700,800 or 900.

Thanks,
Justin



Re: [Flex JS] Font weight issues

Posted by Alex Harui <ah...@adobe.com>.
SimpleCSSStylesImpl is Simple.  FontWeight is expecting bold or normal
since that's what Flash supports for free and is less code.

Hopefully someday someone will write AdvancedCSSStylesImpl.

Thanks for pointing it out though,
-Alex

On 3/2/17, 9:45 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>Just a FYI in case this trips anyone else up.
>
>The code in applyStyle in SimpleCSSValuesImpl assumes that most CSS style
>numbers are pixels - this is not be the case.
>
>The code in questions is:
>if (typeof(value) == 'number') {
>    if (colorStyles[p])
>        value = CSSUtils.attributeFromColor(value);
>    else
>        value = value.toString() + 'px';
>}
>
>Which for font-weight means you can't use values
>100,200,300,400,500,600,700,800 or 900.
>
>Thanks,
>Justin
>
>