[Webkit-unassigned] [Bug 249688] AX: Expose bold and italic font styling as text attributes for macOS

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 20 21:58:53 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=249688

--- Comment #5 from chris fleizach <cfleizach at apple.com> ---
(In reply to Tommy McHugh from comment #4)
> (In reply to chris fleizach from comment #3)
> > do we not have keys for these already? 
> > does iOS not use AXAttributedStringSetFont ?
> iOS does use AXttributedStringSetFont and uses
> UIAccessibilityTokenBold/Italic. MacOS doesn't have an existing key so we
> could either add one like this patch currently does that follows macOS
> attribute naming style or we could just untarget the iOS code so that it
> compiles for macOS and iOS and expose the iOS keys as those are defined in
> this file for all platforms.

On macOS, it looks like the proper way to get bold status is use the font text attributes

[attributedString addAttribute:NSAccessibilityFontTextAttribute value:fontAttributes.get() range:range];

and then recreate your font to get the bold status

 CTFontRef fontRef = _copyFontRefForFontAttributes(fontAttributes);
    if (fontRef != NULL)
    {
        CTFontSymbolicTraits fontTraits = CTFontGetSymbolicTraits(fontRef);
        bold = (fontTraits & kCTFontBoldTrait);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221221/a6a17a3c/attachment.htm>


More information about the webkit-unassigned mailing list