User avatar
jinfox
Topic Author
Posts: 24
Joined: 06 Apr 2019, 00:11

Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

20 Mar 2025, 19:42

Hello!

I am currently dealing with localization issues related to How the text wrapping cuts words in half in Korean. When using text wrapping in english or other language using latin alphabet. the wrapping happens in between words using space character or ponctuation. But for Korean, the text is cut in between each character, which breaks the meaning of the words.

Is there a way to force this per-word wrapping explicitly when possible or is that a bug that should be dealt with?

Here is an example snippet I made (you will need to replace the FontFamily bit by a font supporting Korean you have available)
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   <Grid.Resources>
    <Style x:Key="Test" TargetType="TextBlock">
      <Setter Property="TextWrapping" Value="Wrap"/>   
      <Setter Property="FontSize" Value="24"/>
    </Style>
  </Grid.Resources>
  <DockPanel>
 
  <Slider Minimum="100" Maximum="1000" Value="300" x:Name="WidthSlider" DockPanel.Dock="Top" Margin="20" />
  <StackPanel  VerticalAlignment="Center" Orientation="Vertical" Width="{Binding ElementName=WidthSlider, Path=Value}" >
    <Border Background="#55FFAA" Padding="5" Margin="0,30">
      <TextBlock Style="{StaticResource Test}" Text="This is a sample sentence that happends to be a bit long but makes sense. Wrapping this should happen either at the beginning of a new phrase or at a space" />
    </Border>
    
     <Border Background="#55FFAA" Padding="5" Margin="0,30">
      <TextBlock Style="{StaticResource Test}" FontFamily="#Kakao Small Sans" Text="이것은 약간 길지만 의미가 있는 샘플 문장입니다. 이것을 래핑하는 것은 새 구문의 시작 부분이나 공백에서 이루어져야 합니다." />
    </Border>
  </StackPanel>
</DockPanel>
</Grid>
If anyone has advise on how to deal with this situation, it will be greatly appreciated!
Thanks!
 
User avatar
jsantos
Site Admin
Posts: 4309
Joined: 20 Jan 2012, 17:18
Contact:

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

21 Mar 2025, 16:05

Hello!

Noesis follows the Unicode Line Breaking Algorithm. While there may be mistakes, we are always open to fixing them as soon as possible. However, in my initial experiments with WPF, I have observed similar behavior.

The mentioned line-breaking algorithm includes some 'optional' behaviors that need to be enabled. Could you please specify exactly what you are expecting, ideally with a screenshot?
 
User avatar
jinfox
Topic Author
Posts: 24
Joined: 06 Apr 2019, 00:11

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

21 Mar 2025, 16:43

Hello !
Korean's text wrapping should normally behave similar to English (space character are used for linebreak candidate in order to not split the meaning of words, I am not an expert in Korean unfortunately but for example the deault behavior of Unreal UMG is the correct way to wrap Korean text. I made a gif of it :
Korean Text Wrapping.gif
The rule in question in the unicode page you are mentioning is related to Hangul syllables : https://www.unicode.org/reports/tr14/#H2
 
User avatar
jsantos
Site Admin
Posts: 4309
Joined: 20 Jan 2012, 17:18
Contact:

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

24 Mar 2025, 17:46

Honestly, I am not sure if Unreal is right here.

https://forum.literatureandlatte.com/t/ ... age/143137
It is fine for the Korean word to be cut off in the middle, but it is NOT fine if the entire word just teleports to the next line and leaving a huge empty space.
Readers hate it. Writers hate it. It is unbearable.
Could you please double check with a Korean translator? We are fine to expose what you want in a #define in code.
 
User avatar
jinfox
Topic Author
Posts: 24
Joined: 06 Apr 2019, 00:11

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

24 Mar 2025, 18:01

This was flagged to us from our localization teams which have native korean speakers. I would assume this is maybe contextual based on some of the usages. Actually I think this is why Unreal exposes this under the Console variable 'Localization.HangulTextWrappingMethod'. If you could expose that to us so we can select our preferred behavior as well, that would be perfect!
 
User avatar
jsantos
Site Admin
Posts: 4309
Joined: 20 Jan 2012, 17:18
Contact:

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

25 Mar 2025, 03:27

I see, HangulTextWrappingMethod is PerWord, by default.

This makes sense with UAX14 notes: "Depending on the nature of the document, Korean either uses implicit breaking around characters (type 2 as defined in Section 3, Introduction) or uses spaces (type 1). Space-based layout is common in magazines and other informal documents with ragged margins, while books, with both margins justified, use the other type, as it affords more line break opportunities and therefore leads to better justification."

Please, create a ticket for this and I will provide a patch.
 
User avatar
jinfox
Topic Author
Posts: 24
Joined: 06 Apr 2019, 00:11

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

25 Mar 2025, 09:30

Thank you very much ! here is the ticket I have created : https://www.noesisengine.com/bugs/view.php?id=4007
 
User avatar
jsantos
Site Admin
Posts: 4309
Joined: 20 Jan 2012, 17:18
Contact:

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

26 Mar 2025, 11:26

Thank you for this!
 
User avatar
jsantos
Site Admin
Posts: 4309
Joined: 20 Jan 2012, 17:18
Contact:

Re: Text Wrapping in Textblock in Korean cutting in middle of words instead of space character

26 Mar 2025, 18:43

Patch attached to the ticked. Thanks for your feedback!

Who is online

Users browsing this forum: No registered users and 25 guests