Skip to content
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

fStyle doesn't recognize "oblique" #3124

Open
fazdzz opened this issue Oct 30, 2024 · 0 comments
Open

fStyle doesn't recognize "oblique" #3124

fazdzz opened this issue Oct 30, 2024 · 0 comments

Comments

@fazdzz
Copy link

fazdzz commented Oct 30, 2024

the following code only recognize 'normal' and 'italic' as fStyle

function getFontProperties(fontData) {
var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];
var fWeight = 'normal'; var
fStyle = 'normal';
var len = styles.length;
var styleName;
for (var i = 0; i < len; i += 1) {
styleName = styles[i].toLowerCase();
switch (styleName) {
case 'italic':
fStyle = 'italic';
break;
case 'bold':
fWeight = '700';
break;
case 'black':
fWeight = '900';
break;
case 'medium':
fWeight = '500';
break;
case 'regular':
case 'normal':
fWeight = '400';
break;
case 'light':
case 'thin':
fWeight = '200';
break;
default:
break;
}
}
return {
style: fStyle,
weight: fontData.fWeight || fWeight,
};
}

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

No branches or pull requests

1 participant