From b73a68edabc3012d00d7a26afd24a581de7c23a8 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Fri, 4 Mar 2011 14:53:16 +0000 Subject: [PATCH] Fixed text scaling. svn path=/trunk/netsurf/; revision=11905 --- cocoa/font.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cocoa/font.m b/cocoa/font.m index 1b06d3dc7..a109d027f 100644 --- a/cocoa/font.m +++ b/cocoa/font.m @@ -113,7 +113,10 @@ void cocoa_set_font_scale_factor( float newFactor ) void cocoa_draw_string( CGFloat x, CGFloat y, const char *bytes, size_t length, const plot_font_style_t *style ) { - NSLayoutManager *layout = cocoa_prepare_layout_manager( bytes, length, style ); + plot_font_style_t actualStyle = *style; + actualStyle.size = (CGFloat)actualStyle.size * cocoa_font_scale_factor; + + NSLayoutManager *layout = cocoa_prepare_layout_manager( bytes, length, &actualStyle ); if (layout == nil) return; NSFont *font = [cocoa_text_storage attribute: NSFontAttributeName atIndex: 0 effectiveRange: NULL]; @@ -219,7 +222,7 @@ static NSString * const cocoa_font_families[PLOT_FONT_FAMILY_COUNT] = { static inline NSFont *cocoa_font_get_nsfont( const plot_font_style_t *style ) { NSFont *font = [NSFont fontWithName: cocoa_font_families[style->family] - size: cocoa_font_scale_factor * (CGFloat)style->size / FONT_SIZE_SCALE]; + size: (CGFloat)style->size / FONT_SIZE_SCALE]; NSFontTraitMask traits = 0; if (style->flags & FONTF_ITALIC || style->flags & FONTF_OBLIQUE) traits |= NSItalicFontMask;