Chinese Font Support #855

Closed
opened 2025-11-20 05:18:41 -05:00 by saavagebueno · 5 comments
Owner

Originally created by @Yxnt on GitHub (May 7, 2024).

Describe the problem

client latest version (v0.27.4) added the Network Routes Panel, when there is Chinese will display garbled code, this is because Fyne does not support Chinese fonts by default, Fyne's solution to this issue

To Reproduce

Steps to reproduce the behavior:

  1. Open Web Dashboard
  2. Open network-routes page
  3. Add New Route
  4. Enter the name “测试”

Expected behavior

recommended to use noto fonts (OFL) for commercial licensing reasons.

NetBird version

0.27.4

Screenshots
0.27.4 version
image

local debug version
image

Additional context

But I set the FYNE_FONT environment variable before running Netbird UI, which can solve the problem of garbled code, the code is very simple to add the init method (currently the package for internal employees is done this way)

//client_ui.go
func init() {
	defaultFontPath := "./fonts/NotoSansSC-Regular.ttf"
	font, exists := os.LookupEnv("FYNE_FONT")

	if exists {
		os.Setenv("FYNE_FONT", font)
	} else {
		os.Setenv("FYNE_FONT", defaultFontPath)
	}
}

Originally created by @Yxnt on GitHub (May 7, 2024). **Describe the problem** client latest version (v0.27.4) added the Network Routes Panel, when there is Chinese will display garbled code, this is because Fyne does not support Chinese fonts by default, Fyne's solution to this [issue](https://github.com/fyne-io/fyne/issues/2660#issuecomment-1046591932) **To Reproduce** Steps to reproduce the behavior: 1. Open Web Dashboard 2. Open network-routes page 3. Add New Route 4. Enter the name “测试” **Expected behavior** recommended to use [noto fonts ](https://fonts.google.com/noto)(OFL) for commercial licensing reasons. **NetBird version** `0.27.4` **Screenshots** 0.27.4 version ![image](https://github.com/netbirdio/netbird/assets/10323352/bb006e07-1570-4ccc-98f6-e72b95e05c4f) local debug version ![image](https://github.com/netbirdio/netbird/assets/10323352/99b9ec68-4c6e-4341-80ed-8e606cb3afc0) **Additional context** But I set the FYNE_FONT environment variable before running Netbird UI, which can solve the problem of garbled code, the code is very simple to add the init method (currently the package for internal employees is done this way) ```go //client_ui.go func init() { defaultFontPath := "./fonts/NotoSansSC-Regular.ttf" font, exists := os.LookupEnv("FYNE_FONT") if exists { os.Setenv("FYNE_FONT", font) } else { os.Setenv("FYNE_FONT", defaultFontPath) } } ```
saavagebueno added the bugclient-ui labels 2025-11-20 05:18:41 -05:00
Author
Owner

@MrChenhtlss commented on GitHub (May 14, 2024):

Yes it does exist and I'm waiting for it to be fixed
image

@MrChenhtlss commented on GitHub (May 14, 2024): Yes it does exist and I'm waiting for it to be fixed <img width="339" alt="image" src="https://github.com/netbirdio/netbird/assets/146620104/f9df2c8d-6426-4a2c-8413-d545abe8a3f5">
Author
Owner

@Yxnt commented on GitHub (May 14, 2024):

maybe other language should also be support, not only Chinese.

:)

@Yxnt commented on GitHub (May 14, 2024): maybe other language should also be support, not only Chinese. :)
Author
Owner

@mlsmaycon commented on GitHub (May 14, 2024):

This is bad; thanks for reporting, folks. We will handle it.

@mlsmaycon commented on GitHub (May 14, 2024): This is bad; thanks for reporting, folks. We will handle it.
Author
Owner

@Yxnt commented on GitHub (Jun 20, 2024):

This is bad; thanks for reporting, folks. We will handle it.

I think this can be solved without adding font files to the project, by calling the system default font files directly based on the system locale. I can try to solve this problem

@Yxnt commented on GitHub (Jun 20, 2024): > This is bad; thanks for reporting, folks. We will handle it. I think this can be solved without adding font files to the project, by calling the system default font files directly based on the system locale. I can try to solve this problem
Author
Owner

@Yxnt commented on GitHub (Jun 25, 2024):

@MrChenhtlss I submitted a PR, remember to update it when I wait for the merge to be posted :)

@Yxnt commented on GitHub (Jun 25, 2024): @MrChenhtlss I submitted a PR, remember to update it when I wait for the merge to be posted :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#855