summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-10-12 14:54:46 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-10-12 22:14:18 +0200
commit807b0507563b1c54822dd302b210931297acde23 (patch)
tree970dc1a05c904c69c4fd643fa9174f54da346b18 /vcl
parent3d1cd490ac0366245c4b55d711611c21149a76e9 (diff)
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.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/accessibility/AccessibleTextAttributeHelper.cxx16
1 files changed, 16 insertions, 0 deletions
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";