@@ -1508,18 +1508,26 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
15081508 cfNew.wWeight =
15091509 props.textAttributes .fontWeight ? static_cast <WORD>(*props.textAttributes .fontWeight ) : DWRITE_FONT_WEIGHT_NORMAL;
15101510
1511- // set font style
1512- // cfNew.dwMask |= (CFM_ITALIC | CFM_STRIKEOUT | CFM_UNDERLINE);
1513- // int dFontStyle = fontDetails.FontStyle;
1514- // if (dFontStyle & FS_Italic) {
1515- // cfNew.dwEffects |= CFE_ITALIC;
1516- // }
1517- // if (dFontStyle & FS_StrikeOut) {
1518- // cfNew.dwEffects |= CFE_STRIKEOUT;
1519- // }
1520- // if (dFontStyle & FS_Underline) {
1521- // cfNew.dwEffects |= CFE_UNDERLINE;
1522- // }
1511+ // set font style (italic)
1512+ cfNew.dwMask |= CFM_ITALIC;
1513+ if (props.textAttributes .fontStyle == facebook::react::FontStyle::Italic ||
1514+ props.textAttributes .fontStyle == facebook::react::FontStyle::Oblique) {
1515+ cfNew.dwEffects |= CFE_ITALIC;
1516+ }
1517+
1518+ // set text decoration (underline and strikethrough)
1519+ cfNew.dwMask |= (CFM_UNDERLINE | CFM_STRIKEOUT);
1520+ if (props.textAttributes .textDecorationLineType .has_value ()) {
1521+ auto decorationType = *props.textAttributes .textDecorationLineType ;
1522+ if (decorationType == facebook::react::TextDecorationLineType::Underline ||
1523+ decorationType == facebook::react::TextDecorationLineType::UnderlineStrikethrough) {
1524+ cfNew.dwEffects |= CFE_UNDERLINE;
1525+ }
1526+ if (decorationType == facebook::react::TextDecorationLineType::Strikethrough ||
1527+ decorationType == facebook::react::TextDecorationLineType::UnderlineStrikethrough) {
1528+ cfNew.dwEffects |= CFE_STRIKEOUT;
1529+ }
1530+ }
15231531
15241532 // set font family
15251533 if (!props.textAttributes .fontFamily .empty ()) {
0 commit comments