diff options
author | Boris Dušek <me@dusek.me> | 2013-08-11 08:44:26 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-08-12 07:27:14 +0000 |
commit | 3e9ae4da947cd9c3f75b6e4942f2ba52337df075 (patch) | |
tree | 8463369376ce5c3bd331086a59eeae0413631b89 /vcl/aqua | |
parent | 38aad8c3a73b748672f551e7b8efe9fa3a7c8834 (diff) |
fdo#67957: Font name reported in AXFont always Times New Roman
This is a partial fix. Now VoiceOver does report changes in font faces
but it works correctly only when the paragraph text style has font
"Times New Roman". If it has not, then parts of the text with
"Times New Roman" have not change in font reported, but parts with
font different both from the paragraph style font and "Times New Roman"
do have font change reported.
In other words, the default font for paragraph is still "Times New Roman"
in accessibility even though sometimes it's not true.
This also fixes font size being reported only when bold or italic is set,
and has more robustness for handling mixed bold/italic when at least one
of them is set in the paragraph style as well.
Change-Id: Id0715727d04cd9b814aa0e4093939cd3e6abe897
Reviewed-on: https://gerrit.libreoffice.org/5344
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'vcl/aqua')
-rw-r--r-- | vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm | 20 | ||||
-rw-r--r-- | vcl/aqua/source/a11y/aqua11ywrapper.mm | 9 |
2 files changed, 25 insertions, 4 deletions
diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 2e4ab40a5034..e8a676e0924b 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -50,7 +50,7 @@ using namespace ::rtl; } +(int)convertBoldStyle:(PropertyValue)property { - int boldStyle = 0; + int boldStyle = NSUnboldFontMask; float value = 0; property.Value >>= value; if ( value == ::css_awt::FontWeight::SEMIBOLD @@ -63,7 +63,7 @@ using namespace ::rtl; } +(int)convertItalicStyle:(PropertyValue)property { - int italicStyle = 0; + int italicStyle = NSUnitalicFontMask; sal_Int16 value = property.Value.get< ::css_awt::FontSlant>(); if ( value == ::css_awt::FontSlant_ITALIC ) { italicStyle = NSItalicFontMask; @@ -198,10 +198,22 @@ using namespace ::rtl; if ( wrapperStore != nil ) { // default [ wrapperStore setDefaultFontname: CreateNSString ( fontname ) ]; [ wrapperStore setDefaultFontsize: fontsize ]; + [ wrapperStore setDefaultFonttraits: fonttraits ]; NSFont * font = [ [ NSFontManager sharedFontManager ] fontWithFamily: CreateNSString ( fontname ) traits: fonttraits weight: 0 size: fontsize ]; [ AquaA11yTextAttributesWrapper addFont: font toString: string forRange: range ]; - } else if ( wrapper != nil && fonttraits != 0 ) { // attribute run and bold and/or italic was found - NSFont * font = [ [ NSFontManager sharedFontManager ] fontWithFamily: [ wrapper defaultFontname ] traits: fonttraits weight: 0 size: [ wrapper defaultFontsize ] ]; + } else if ( wrapper != nil) { // attribute run and bold and/or italic was found + NSString *fontName = nil; + if (fontname.isEmpty()) + fontName = [wrapper defaultFontname]; + else + fontName = CreateNSString(fontname); + if (!(fonttraits & (NSBoldFontMask | NSUnboldFontMask))) + fonttraits |= [wrapper defaultFonttraits] & (NSBoldFontMask | NSUnboldFontMask); + if (!(fonttraits & (NSItalicFontMask | NSUnitalicFontMask))) + fonttraits |= [wrapper defaultFonttraits] & (NSItalicFontMask | NSUnitalicFontMask); + if (fontsize == 0.0) + fontsize = [wrapper defaultFontsize]; + NSFont * font = [ [ NSFontManager sharedFontManager ] fontWithFamily: fontName traits: fonttraits weight: 0 size: fontsize ]; [ AquaA11yTextAttributesWrapper addFont: font toString: string forRange: range ]; } [ pool release ]; diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index bb0d81b18f52..375997f6f77f 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -82,6 +82,7 @@ static std::ostream &operator<<(std::ostream &s, NSPoint point) { -(void) setDefaults: (Reference < XAccessibleContext >) rxAccessibleContext { mDefaultFontsize = 0.0; + mDefaultFonttraits = 0; mpDefaultFontname = nil; mpReferenceWrapper = new ReferenceWrapper; mActsAsRadioGroup = NO; @@ -1145,6 +1146,14 @@ Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point poin return mDefaultFontsize; } +-(void)setDefaultFonttraits:(int)fonttraits { + mDefaultFonttraits = fonttraits; +} + +-(int)defaultFonttraits { + return mDefaultFonttraits; +} + -(void)setActsAsRadioGroup:(BOOL)actsAsRadioGroup { mActsAsRadioGroup = actsAsRadioGroup; } |