Skip to content

Question: font weight and style order #1620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
asturur opened this issue Jul 15, 2020 · 2 comments
Closed

Question: font weight and style order #1620

asturur opened this issue Jul 15, 2020 · 2 comments
Labels

Comments

@asturur
Copy link
Contributor

asturur commented Jul 15, 2020

Issue or Feature

In fabricJS code there is this comment since many years:

ctx.font =  [
        // node-canvas needs "weight style", while browsers need "style weight"
        (fabric.isLikelyNode ? style.fontWeight : style.fontStyle),
        (fabric.isLikelyNode ? style.fontStyle : style.fontWeight),
        forMeasuring ? this.CACHE_FONT_SIZE + 'px' : style.fontSize + 'px',
        fontFamily
      ].join(' ');

Is this actally true? does ctx.font in node-canvas require weight and style in a different order?
And can we fix it with a getter or something in case?

@asturur asturur changed the title font weight and style order: Question: font weight and style order Jul 15, 2020
@zbjornson
Copy link
Collaborator

zbjornson commented Jul 15, 2020

We should be to-spec since #891 and #944 (2.0.0-alpha.1). See https://github.com/Automattic/node-canvas/pull/944/files for the tests and syntax:

[ [ <‘font-style’> || <font-variant-css21> || <‘font-weight’> || <‘font-stretch’> ]?
    <‘font-size’> [ / <‘line-height’> ]? <‘font-family’> ]

Before that it was reversed as you said: 3d54505#diff-71d7843dbc8530a1e457267398396291L50-L55 (bug #566)

@asturur
Copy link
Contributor Author

asturur commented Jul 15, 2020

ok so i should remove that code from fabric, is doing just mess.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants