Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions platforms/windows/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 12 additions & 1 deletion platforms/windows/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -158,6 +158,17 @@ impl<T: Into<Variant>> From<Option<T>> for Variant {
}
}

impl<T: Into<Variant> + std::fmt::Debug + PartialEq> From<TextRangePropertyValue<T>> for Variant {
fn from(value: TextRangePropertyValue<T>) -> Self {
match value {
TextRangePropertyValue::Single(value) => value.into(),
TextRangePropertyValue::Mixed => unsafe { UiaGetReservedMixedAttributeValue() }
.unwrap()
.into(),
}
}
}

impl From<Vec<IUnknown>> for Variant {
fn from(value: Vec<IUnknown>) -> Self {
if value.is_empty() {
Expand Down