Kaydet (Commit) 0ea4a012 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

It's the font *style* we are looking at here

So no point in checking font *family* names like "arial" or
"times". Actually, I doubt this whole block of heuristics is
necessary.

Change-Id: I6965c27a7c4bed53db0e7ddaa40b1d09ccc4ad43
üst e0d38b66
...@@ -166,44 +166,40 @@ static bool GetDevFontAttributes( CTFontDescriptorRef font_descriptor, ImplDevFo ...@@ -166,44 +166,40 @@ static bool GetDevFontAttributes( CTFontDescriptorRef font_descriptor, ImplDevFo
} }
CFStringRef string_ref = (CFStringRef)CTFontDescriptorCopyAttribute(font_descriptor, kCTFontStyleNameAttribute); CFStringRef string_ref = (CFStringRef)CTFontDescriptorCopyAttribute(font_descriptor, kCTFontStyleNameAttribute);
rtl::OUString font_name = GetOUString(string_ref); rtl::OUString style(GetOUString(string_ref).toAsciiLowerCase());
rtl::OUString font_name_lc(font_name.toAsciiLowerCase());
CFRelease(string_ref); CFRelease(string_ref);
// heuristics to adjust font slant // heuristics to adjust font slant
if( (font_name_lc.indexOf("oblique") != -1) || if( (style.indexOf("oblique") != -1) ||
(font_name_lc.indexOf("inclined") != -1) || (style.indexOf("inclined") != -1) ||
(font_name_lc.indexOf("slanted") != -1) ) (style.indexOf("slanted") != -1) )
{ {
rDFA.SetItalic( ITALIC_OBLIQUE ); rDFA.SetItalic( ITALIC_OBLIQUE );
} }
// heuristics to adjust font width // heuristics to adjust font width
if (font_name_lc.indexOf("narrow") != -1) if (style.indexOf("narrow") != -1)
{ {
rDFA.SetWidthType( WIDTH_SEMI_CONDENSED ); rDFA.SetWidthType( WIDTH_SEMI_CONDENSED );
} }
// heuristics for font family type // heuristics for font family type
if( (font_name_lc.indexOf("script") != -1) || if( (style.indexOf("script") != -1) ||
(font_name_lc.indexOf("chancery") != -1) || (style.indexOf("chancery") != -1) )
(font_name_lc.indexOf("zapfino") != -1))
{ {
rDFA.SetFamilyType( FAMILY_SCRIPT ); rDFA.SetFamilyType( FAMILY_SCRIPT );
} }
else if( (font_name_lc.indexOf("comic") != -1) || else if( (style.indexOf("comic") != -1) ||
(font_name_lc.indexOf("outline") != -1) || (style.indexOf("outline") != -1) ||
(font_name_lc.indexOf("pinpoint") != -1) ) (style.indexOf("pinpoint") != -1) )
{ {
rDFA.SetFamilyType( FAMILY_DECORATIVE ); rDFA.SetFamilyType( FAMILY_DECORATIVE );
} }
else if( (font_name_lc.indexOf("sans") != -1) || else if( (style.indexOf("sans") != -1) )
(font_name_lc.indexOf("arial") != -1) )
{ {
rDFA.SetFamilyType( FAMILY_SWISS ); rDFA.SetFamilyType( FAMILY_SWISS );
} }
else if( (font_name_lc.indexOf("roman") != -1) || else if( (style.indexOf("roman") != -1) )
(font_name_lc.indexOf("times") != -1) )
{ {
rDFA.SetFamilyType( FAMILY_ROMAN ); rDFA.SetFamilyType( FAMILY_ROMAN );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment