diff options
author | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-17 15:00:18 +0000 |
---|---|---|
committer | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-17 15:00:18 +0000 |
commit | 045183032f29bdb2211bd2933dd318342fecf041 (patch) | |
tree | 78afe291825072d194b74b5623ebddf97bceb6ae /cocoa/font.m | |
parent | d2aa0bcea9cb25f11ad59911a9f191efddf818d5 (diff) | |
download | netsurf-045183032f29bdb2211bd2933dd318342fecf041.tar.gz netsurf-045183032f29bdb2211bd2933dd318342fecf041.tar.bz2 |
Font scaling and other scaling related fixes.
svn path=/trunk/netsurf/; revision=11349
Diffstat (limited to 'cocoa/font.m')
-rw-r--r-- | cocoa/font.m | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cocoa/font.m b/cocoa/font.m index 0b78c4d80..2e38b33f5 100644 --- a/cocoa/font.m +++ b/cocoa/font.m @@ -159,9 +159,19 @@ static NSLayoutManager *cocoa_prepare_layout_manager( const char *bytes, size_t return layout; } +static CGFloat cocoa_font_scale_factor = 1.0; + +void cocoa_set_font_scale_factor( float newFactor ) +{ + cocoa_font_scale_factor = newFactor; +} + void cocoa_draw_string( int x, int 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 scaledStyle = *style; + scaledStyle.size *= cocoa_font_scale_factor; + + NSLayoutManager *layout = cocoa_prepare_layout_manager( bytes, length, &scaledStyle ); if ([cocoa_text_storage length] > 0) { NSFont *font = [cocoa_text_storage attribute: NSFontAttributeName atIndex: 0 effectiveRange: NULL]; |