Skip to content

Commit

Permalink
enhancement: whole word wrapping for label, candidate, and comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed May 22, 2024
1 parent 18da8b5 commit 7882176
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion WeaselUI/DirectWriteResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ HRESULT DirectWriteResources::InitResources(
pLabelTextFormat.Reset();
pCommentTextFormat.Reset();
DWRITE_WORD_WRAPPING wrapping =
((_style.max_width == 0 &&
_style.layout_type != UIStyle::LAYOUT_VERTICAL_TEXT) ||
(_style.max_height == 0 &&
_style.layout_type == UIStyle::LAYOUT_VERTICAL_TEXT))
? DWRITE_WORD_WRAPPING_NO_WRAP
: DWRITE_WORD_WRAPPING_WHOLE_WORD;
DWRITE_WORD_WRAPPING wrapping_preedit =
((_style.max_width == 0 &&
_style.layout_type != UIStyle::LAYOUT_VERTICAL_TEXT) ||
(_style.max_height == 0 &&
Expand Down Expand Up @@ -174,7 +181,7 @@ HRESULT DirectWriteResources::InitResources(
pPreeditTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);
pPreeditTextFormat->SetParagraphAlignment(
DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
pPreeditTextFormat->SetWordWrapping(wrapping);
pPreeditTextFormat->SetWordWrapping(wrapping_preedit);
_SetFontFallback(pPreeditTextFormat, fontFaceStrVector);
if (_style.linespacing && _style.baseline)
pPreeditTextFormat->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM,
Expand Down

0 comments on commit 7882176

Please sign in to comment.