File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,26 @@ enum FontWidth {
36
36
FontWidthUltraExpanded = 9
37
37
};
38
38
39
+ inline FontWeight resolve_font_weight (FT_UShort weight) {
40
+ if (weight == 0 ) return FontWeightUndefined;
41
+ if (weight < 150 ) return FontWeightThin;
42
+ if (weight < 250 ) return FontWeightUltraLight;
43
+ if (weight < 350 ) return FontWeightLight;
44
+ if (weight < 450 ) return FontWeightNormal;
45
+ if (weight < 550 ) return FontWeightMedium;
46
+ if (weight < 650 ) return FontWeightSemiBold;
47
+ if (weight < 750 ) return FontWeightBold;
48
+ if (weight < 850 ) return FontWeightUltraBold;
49
+ return FontWeightHeavy;
50
+ }
51
+
39
52
inline FontWeight get_font_weight (FT_Face face) {
40
53
void * table = FT_Get_Sfnt_Table (face, FT_SFNT_OS2);
41
54
if (table == NULL ) {
42
55
return FontWeightUndefined;
43
56
}
44
57
TT_OS2* os2_table = (TT_OS2*) table;
45
- return (FontWeight) os2_table->usWeightClass ;
58
+ return resolve_font_weight ( os2_table->usWeightClass ) ;
46
59
}
47
60
48
61
inline FontWidth get_font_width (FT_Face face) {
You can’t perform that action at this time.
0 commit comments