User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: NOESIS Samples - Localization and language specific fonts

08 Dec 2025, 13:43

Hey Sam, I’ve reread your message, and the issue of overlapping Unicode code points for different CJK characters can’t be fully addressed with my previous proposal.

A potential solution would be to use a single CJK font that covers all CJK Unified Ideographs as the main font, with separate fallbacks for JP, KR, and SC. These fallbacks should not overlap, because if they do, resolving the issue would require the composite font solution described in ticket #2380, or manually editing the fonts to remove overlapping glyphs.
 
samc
Posts: 94
Joined: 21 Aug 2019, 19:22

Re: NOESIS Samples - Localization and language specific fonts

08 Dec 2025, 23:17

Hey Sam,

Yes, that is accurate. Your Japanese glyphs could be blocking your Chinese glyphs, and vice versa.

There is a ticket for addressing this with composite fonts (#2380) but it is not a trivial solution.

A valid workaround is to edit your fonts and remove unnecessary changes.
Just so I understand correctly, though, there is some unicode characters that are re-used across all fonts, and so if I'm using some of those unicode characters, there is no way to get proper fallback behavior until that bug you mentioned is addressed?

Is there no other way to work around this? Wondering if there is some way we could manually change the font fallbacks or family via code, or dynamically doing it somehow?

thanks!
sam
 
User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: NOESIS Samples - Localization and language specific fonts

09 Dec 2025, 01:24

To clarify, fallback stops as soon as a font contains a glyph for a given code point. This is expected behavior, not a bug. Ticket #2380 is not about fixing fallback, but about introducing a system for composite fonts, where we can selectively exclude code ranges in a font so fallback can continue past it. Today, this can only be done manually by editing the font to remove overlapping characters, which is a valid workaround but not always convenient.

However, the issue you’re describing sounds slightly different. You may instead need to adjust the fallback chain dynamically based on which language you are rendering. That is something you can do on your side programmatically (changing font family depending on locale or text content), but I’d like to investigate whether we can provide a more built-in solution on our side as well.

My next step is to try reproducing this using a minimal XAML test with just two fonts and observe how WPF handles the same case. If possible, could you provide a small XAML snippet or sample TextBlock that demonstrates your scenario clearly? Having a reduced example will help us analyze the fallback behavior and determine whether we can improve it internally.

Thanks,
 
samc
Posts: 94
Joined: 21 Aug 2019, 19:22

Re: NOESIS Samples - Localization and language specific fonts

09 Dec 2025, 23:03

Unfortunately, I don't have an easy to reproduce example, because a lot of these bugs come via fully dynamic chat/gamer tags/etc.

However, here is an example of what it should look like with the different Noto Sans fonts:

Image

As you can see, there are subtle differences.

thanks,
sam
 
User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: NOESIS Samples - Localization and language specific fonts

10 Dec 2025, 14:32

I have been investigating this, understanding how this is solved in vanilla WPF.
<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <Page.Resources>
    <FontFamily x:Key="MyFont"> 
      <FontFamily.FamilyMaps>
        <!-- Punctuation (overlaps) -->
        <FontFamilyMap Unicode="3000-303F" Target="Meiryo" Language="ja-JP"/>  <!-- Japanese punctuation -->
        <FontFamilyMap Unicode="3000-303F" Target="SimSun" Language="zh-CN"/>  <!-- Simplified Chinese punctuation -->
        <FontFamilyMap Unicode="3000-303F" Target="MingLiU" Language="zh-TW"/> <!-- Traditional Chinese punctuation -->
        <!-- Han (CJK Unified Ideographs) -->
        <FontFamilyMap Unicode="4E00-9FFF" Target="Meiryo" Language="ja-JP"/>  <!-- prefer Meiryo for Japanese -->
        <FontFamilyMap Unicode="4E00-9FFF" Target="SimSun" Language="zh-CN"/>  <!-- prefer SimSun for Simplified Chinese -->
        <FontFamilyMap Unicode="4E00-9FFF" Target="MingLiU" Language="zh-TW"/> <!-- prefer MingLiU for Traditional Chinese -->
        <!-- catch-all fallback -->
        <FontFamilyMap Unicode="0000-FFFF" Target="Segoe UI"/>
      </FontFamily.FamilyMaps>
    </FontFamily>
  </Page.Resources>

  <StackPanel>  
    <TextBlock Language="ja-JP" FontSize="40" FontFamily="{StaticResource MyFont}">骨 (JP)</TextBlock>
    <TextBlock  Language="zh-CN" FontSize="40" FontFamily="{StaticResource MyFont}">骨 (CN)</TextBlock>
    <TextBlock  Language="zh-TW" FontSize="40" FontFamily="{StaticResource MyFont}">骨 (TW)</TextBlock>
  </StackPanel>
</Page>
I have updated the ticket (#2380) with this information and a workaround.

Please, let us know if this approach would work for you.
 
samc
Posts: 94
Joined: 21 Aug 2019, 19:22

Re: NOESIS Samples - Localization and language specific fonts

11 Dec 2025, 03:17

That looks really awesome! We'll be looking forward to that change!

As a temp workaround, I'm just tweaking the app resource ditionary where our style is stored, switching out the main font families we use based on locale.

thanks,
sam

Who is online

Users browsing this forum: No registered users and 4 guests