mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 13:37:02 +03:00
More font traits
svn path=/trunk/netsurf/; revision=11359
This commit is contained in:
parent
b3690a585d
commit
5105548de6
14
cocoa/font.m
14
cocoa/font.m
@ -105,8 +105,20 @@ static NSString *cocoa_font_family_name( plot_font_generic_family_t family )
|
||||
|
||||
static NSFont *cocoa_font_get_nsfont( const plot_font_style_t *style )
|
||||
{
|
||||
return [NSFont fontWithName: cocoa_font_family_name( style->family )
|
||||
NSFont *font = [NSFont fontWithName: cocoa_font_family_name( style->family )
|
||||
size: (CGFloat)style->size / FONT_SIZE_SCALE];
|
||||
|
||||
NSFontTraitMask traits = 0;
|
||||
if (style->flags & FONTF_ITALIC || style->flags & FONTF_OBLIQUE) traits |= NSItalicFontMask;
|
||||
if (style->flags & FONTF_SMALLCAPS) traits |= NSSmallCapsFontMask;
|
||||
if (style->weight > 400) traits |= NSBoldFontMask;
|
||||
|
||||
if (0 != traits) {
|
||||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
||||
font = [fm convertFont: font toHaveTrait: traits];
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
NSDictionary *cocoa_font_attributes( const plot_font_style_t *style )
|
||||
|
Loading…
Reference in New Issue
Block a user