vcl/source/accessibility/AccessibleTextAttributeHelper.cxx | 16 +++++++++++++ 1 file changed, 16 insertions(+)
New commits: commit 807b0507563b1c54822dd302b210931297acde23 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Oct 12 14:54:46 2023 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Oct 12 22:14:18 2023 +0200 tdf#157696 a11y: Map "CharEscapement" text attr to IA2 "text-position" While the gtk3 implementation (see `Escapement2VerticalAlign` in `vcl/unx/gtk3/a11y/atktextattributes.cxx`) bridges numeric values to ATK/AT-SPI, the IAccessible2 text attribute specification [1] only allows the 3 values "baseline", "super" and "sub". With this in place, Orca with the qt6 VCL plugin on Linux and NVDA on Windows (with the WIP branches to switch both LO's winaccessibility and NVDA to the IAccessible2 text attributes) announce the subscript and superscript text in the tdf#157696 sample document as expected. (For Orca, announcement of the "vertical-align" text attribute is off by default, so that first needs to be enabled in the "Text Attributes" section of the Orca configuration dialog.) [1] http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-vertical-align Change-Id: I1e4ea014cf818fefd009089be183615abf67aada Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157867 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx b/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx index d3c77b9a6233..d8ffa5161930 100644 --- a/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx +++ b/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx @@ -27,6 +27,16 @@ namespace { +OUString lcl_ConvertCharEscapement(sal_Int16 nEscapement) +{ + if (nEscapement > 0) + return "super"; + if (nEscapement < 0) + return "sub"; + + return "baseline"; +} + OUString lcl_convertFontWeight(double fontWeight) { if (fontWeight == css::awt::FontWeight::THIN || fontWeight == css::awt::FontWeight::ULTRALIGHT) @@ -180,6 +190,12 @@ OUString AccessibleTextAttributeHelper::ConvertUnoToIAccessible2TextAttributes( sValue = lcl_ConvertColor( Color(ColorTransparency, *o3tl::doAccess<sal_Int32>(prop.Value))); } + else if (prop.Name == "CharEscapement") + { + sAttribute = "text-position"; + const sal_Int16 nEscapement = *o3tl::doAccess<sal_Int16>(prop.Value); + sValue = lcl_ConvertCharEscapement(nEscapement); + } else if (prop.Name == "CharFontName") { sAttribute = "font-family";