fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.1k stars 1.4k forks source link

Unicode characters not showing properly, any solution? #1579

Closed mateors closed 7 months ago

mateors commented 3 years ago

I am developing a stk based windows gui application and for that using fyne library but unfortunately it seems fyne package unable to parse unicode character properly, but in golang codebase i can successfully print unicode character...so whats wrong?

I already set environtment variable using os.Setenv("FYNE_FONT", "SolaimanLipi.ttf")

image

andydotxyz commented 3 years ago

The usage of FYNE_FONT references a file on the filesystem - when you package and ship your app then the file may not be found. If you want to package a font in the application you probably need to use a custom Theme along with bundling the font file using "fyne bundle"

mateors commented 3 years ago

@andydotxyz I must bundle the font when ship but now already font file in the same directory where my code base exist, so it should not create any issue for this problem. The same message using c# code base working fine. can you help me how can i fix this issue?

andydotxyz commented 3 years ago

Go based (and Fyne) apps are designed to distribute as a single file. You can use "fyne bundle" to embed assets in this file https://developer.fyne.io/tutorial/bundle. Otherwise you can provide the .ttf file and tell your app users to place the file next to your app when they install.

mateors commented 3 years ago

@andydotxyz can you show me a sample code? how can i create custom theme and use distributed font generate using bundle?

andydotxyz commented 3 years ago

See https://github.com/andydotxyz/beebui/, specifically you can see a custom font bundled in gen.sh and used at https://github.com/andydotxyz/beebui/blob/f886e993bd9aa327ae3f411be49cdde9df4b4b2a/theme.go#L89

andydotxyz commented 7 months ago

This is resolved by PR #4721

andydotxyz commented 7 months ago

Looks like this issue #2572 is the root cause, either way both are about to be fixed.