vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm | 20 +++++++++++++++---- vcl/aqua/source/a11y/aqua11ywrapper.mm | 9 ++++++++ vcl/inc/aqua/aqua11ywrapper.h | 3 ++ 3 files changed, 28 insertions(+), 4 deletions(-)
New commits: commit a6edddefab9f46defc0cee262c38bb8eae32916a Author: Boris Dušek <m...@dusek.me> Date: Sun Aug 11 08:44:26 2013 +0200 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 <t...@iki.fi> Tested-by: Tor Lillqvist <t...@iki.fi> Reviewed-on: https://gerrit.libreoffice.org/5495 diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 2e4ab40..e8a676e 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 9a35cbc..fe1ba6d 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -73,6 +73,7 @@ static BOOL isPopupMenuOpen = NO; -(void) setDefaults: (Reference < XAccessibleContext >) rxAccessibleContext { mDefaultFontsize = 0.0; + mDefaultFonttraits = 0; mpDefaultFontname = nil; mpReferenceWrapper = new ReferenceWrapper; mActsAsRadioGroup = NO; @@ -1123,6 +1124,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; } diff --git a/vcl/inc/aqua/aqua11ywrapper.h b/vcl/inc/aqua/aqua11ywrapper.h index da34264..185536a 100644 --- a/vcl/inc/aqua/aqua11ywrapper.h +++ b/vcl/inc/aqua/aqua11ywrapper.h @@ -54,6 +54,7 @@ struct ReferenceWrapper ReferenceWrapper * mpReferenceWrapper; NSString * mpDefaultFontname; float mDefaultFontsize; + int mDefaultFonttraits; BOOL mActsAsRadioGroup; BOOL mIsTableCell; } @@ -94,6 +95,8 @@ struct ReferenceWrapper -(NSString *)defaultFontname; -(void)setDefaultFontsize:(float)fontsize; -(float)defaultFontsize; +-(void)setDefaultFonttraits:(int)fonttraits; +-(int)defaultFonttraits; +(void)setPopupMenuOpen:(BOOL)popupMenuOpen; -(::com::sun::star::accessibility::XAccessibleAction *)accessibleAction; -(::com::sun::star::accessibility::XAccessibleContext *)accessibleContext;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits