diff --git a/platforms/windows/src/text.rs b/platforms/windows/src/text.rs index 39404936..96503b7f 100644 --- a/platforms/windows/src/text.rs +++ b/platforms/windows/src/text.rs @@ -446,6 +446,18 @@ impl ITextRangeProvider_Impl for PlatformRange_Impl { } Ok(value.0.into()) }), + UIA_CultureAttributeId => { + self.read(|range| Ok(Variant::from(range.language().map(LocaleName)).into())) + } + UIA_FontNameAttributeId => { + self.read(|range| Ok(Variant::from(range.font_family()).into())) + } + UIA_FontSizeAttributeId => { + self.read(|range| Ok(Variant::from(range.font_size()).into())) + } + UIA_FontWeightAttributeId => self.read(|range| { + Ok(Variant::from(range.font_weight().map(|value| value as i32)).into()) + }), // TODO: implement more attributes _ => { let value = unsafe { UiaGetReservedNotSupportedValue() }.unwrap(); diff --git a/platforms/windows/src/util.rs b/platforms/windows/src/util.rs index 1efeda9e..94cac694 100644 --- a/platforms/windows/src/util.rs +++ b/platforms/windows/src/util.rs @@ -4,7 +4,7 @@ // the LICENSE-MIT file), at your option. use accesskit::Point; -use accesskit_consumer::TreeState; +use accesskit_consumer::{TextRangePropertyValue, TreeState}; use std::{ fmt::{self, Write}, mem::ManuallyDrop, @@ -158,6 +158,17 @@ impl> From> for Variant { } } +impl + std::fmt::Debug + PartialEq> From> for Variant { + fn from(value: TextRangePropertyValue) -> Self { + match value { + TextRangePropertyValue::Single(value) => value.into(), + TextRangePropertyValue::Mixed => unsafe { UiaGetReservedMixedAttributeValue() } + .unwrap() + .into(), + } + } +} + impl From> for Variant { fn from(value: Vec) -> Self { if value.is_empty() {