mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-29 15:29:42 +03:00
Updated baseline calculation for fonts
svn path=/trunk/netsurf/; revision=11512
This commit is contained in:
parent
46a9e334a0
commit
a1f1138479
11
cocoa/font.m
11
cocoa/font.m
@ -118,14 +118,13 @@ 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 );
|
||||
if (layout == nil) return;
|
||||
|
||||
if ([cocoa_text_storage length] > 0) {
|
||||
NSFont *font = [cocoa_text_storage attribute: NSFontAttributeName atIndex: 0 effectiveRange: NULL];
|
||||
CGFloat baseline = [layout defaultBaselineOffsetForFont: font];
|
||||
NSFont *font = [cocoa_text_storage attribute: NSFontAttributeName atIndex: 0 effectiveRange: NULL];
|
||||
CGFloat baseline = [layout defaultLineHeightForFont: font] * 3.0 / 4.0;
|
||||
|
||||
NSRange glyphRange = [layout glyphRangeForTextContainer: cocoa_text_container];
|
||||
[layout drawGlyphsForGlyphRange: glyphRange atPoint: NSMakePoint( x, y - baseline )];
|
||||
}
|
||||
NSRange glyphRange = [layout glyphRangeForTextContainer: cocoa_text_container];
|
||||
[layout drawGlyphsForGlyphRange: glyphRange atPoint: NSMakePoint( x, y - baseline )];
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user