netbird icon indicating copy to clipboard operation
netbird copied to clipboard

Chinese Font Support

Open Yxnt opened this issue 9 months ago • 5 comments

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)
	}
}

Yxnt avatar May 07 '24 10:05 Yxnt

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

MrChenhtlss avatar May 14 '24 04:05 MrChenhtlss

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

:)

Yxnt avatar May 14 '24 07:05 Yxnt

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

mlsmaycon avatar May 14 '24 08:05 mlsmaycon

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 avatar Jun 21 '24 03:06 Yxnt

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

Yxnt avatar Jun 26 '24 02:06 Yxnt