Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rendering of underline style and color #16097

Merged
merged 24 commits into from
Nov 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d2bea4c
initial commit for underline style and color
tusharsnx Oct 3, 2023
d341402
add new underline styles in UIA
tusharsnx Oct 9, 2023
a042401
draw curly line from the shader
tusharsnx Oct 12, 2023
e16055c
revert D2D antialias mode
tusharsnx Oct 12, 2023
1df5894
fix gridlines being drawn with underline color
tusharsnx Oct 14, 2023
0bdeb1a
add dotted underline to BackendD2D and Dx renderers
tusharsnx Oct 14, 2023
c179041
fix ScrollTest's MockScrollRenderEngine wasn't updated to receive und…
tusharsnx Oct 14, 2023
8684de8
make sine wave start with a crest
tusharsnx Oct 16, 2023
dc986c1
fix strikethrough being drawn with underline color
tusharsnx Oct 16, 2023
bea07a5
add support for underline styles in gdi renderer
tusharsnx Oct 24, 2023
4f13a3c
add spellings
tusharsnx Oct 24, 2023
1f3e535
fix signed/unsigned mismatch
tusharsnx Oct 25, 2023
2babe7b
make small improvements to Atlas curlyline rendering
tusharsnx Oct 25, 2023
e31d0fb
AtlasEngine: use cellBottomGap as the peak height for curly line
tusharsnx Oct 27, 2023
63ae6ce
GDIRenderer: use cellBottomGap as the peak height for curly line
tusharsnx Oct 27, 2023
b5574d0
initialize _curlyLineDrawPeakHeight
tusharsnx Oct 27, 2023
b8d3caa
send line rendition scale using texcoord
tusharsnx Oct 28, 2023
a2c4a36
underlines are mutually exclusive
tusharsnx Oct 28, 2023
6e4c65a
revert underline thickness scaling
tusharsnx Oct 28, 2023
b0be8b6
move curlyline peak height constants into the function
tusharsnx Nov 2, 2023
1ba1782
fix curlyline equation that was making a negative peak at the start
tusharsnx Nov 2, 2023
4f7ba10
BackendD2D: use `else if`
tusharsnx Nov 2, 2023
c7a8a55
shrink QuadInstance::ShadingType and add renditionScale member
tusharsnx Nov 3, 2023
3923fde
replace SelectObject with wil::SelectObject
tusharsnx Nov 4, 2023
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
30 changes: 22 additions & 8 deletions src/types/UiaTextRangeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,22 @@ std::optional<bool> UiaTextRangeBase::_verifyAttr(TEXTATTRIBUTEID attributeId, V
THROW_HR_IF(E_INVALIDARG, val.vt != VT_I4);

// The underline style is stored as a TextDecorationLineStyle.
// However, The text buffer doesn't have that many different styles for being underlined.
// Instead, we only have single and double underlined.
// However, The text buffer doesn't have all the different styles for being underlined.
// Instead, we only use a subset of them.
switch (val.lVal)
tusharsnx marked this conversation as resolved.
Show resolved Hide resolved
{
case TextDecorationLineStyle_None:
return !attr.IsUnderlined();
case TextDecorationLineStyle_Single:
return attr.GetUnderlineStyle() == UnderlineStyle::SinglyUnderlined;
case TextDecorationLineStyle_Double:
return attr.GetUnderlineStyle() == UnderlineStyle::DoublyUnderlined;
case TextDecorationLineStyle_Single: // singly underlined and extended styles are treated the same
return attr.IsUnderlined() && attr.GetUnderlineStyle() != UnderlineStyle::DoublyUnderlined;
case TextDecorationLineStyle_Wavy:
return attr.GetUnderlineStyle() == UnderlineStyle::CurlyUnderlined;
case TextDecorationLineStyle_Dot:
return attr.GetUnderlineStyle() == UnderlineStyle::DottedUnderlined;
case TextDecorationLineStyle_Dash:
return attr.GetUnderlineStyle() == UnderlineStyle::DashedUnderlined;
default:
return std::nullopt;
}
Expand Down Expand Up @@ -697,18 +703,26 @@ bool UiaTextRangeBase::_initializeAttrQuery(TEXTATTRIBUTEID attributeId, VARIANT
const auto style = attr.GetUnderlineStyle();
switch (style)
{
case UnderlineStyle::NoUnderline:
tusharsnx marked this conversation as resolved.
Show resolved Hide resolved
pRetVal->lVal = TextDecorationLineStyle_None;
return true;
case UnderlineStyle::SinglyUnderlined:
pRetVal->lVal = TextDecorationLineStyle_Single;
return true;
case UnderlineStyle::DoublyUnderlined:
pRetVal->lVal = TextDecorationLineStyle_Double;
return true;
case UnderlineStyle::NoUnderline:
pRetVal->lVal = TextDecorationLineStyle_None;
case UnderlineStyle::CurlyUnderlined:
pRetVal->lVal = TextDecorationLineStyle_Wavy;
return true;
case UnderlineStyle::DottedUnderlined:
pRetVal->lVal = TextDecorationLineStyle_Dot;
return true;
case UnderlineStyle::DashedUnderlined:
pRetVal->lVal = TextDecorationLineStyle_Dash;
return true;
// Out of range styles are treated as singly underlined.
default:
// TODO: Handle other underline styles once they're supported in the graphic renderer.
// For now, extended styles are treated (and rendered) as single underline.
pRetVal->lVal = TextDecorationLineStyle_Single;
return true;
}
Expand Down