Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The text on button can't be show correctly when use imported font #2512

Closed
aimin-git opened this issue Sep 28, 2021 · 2 comments
Closed

The text on button can't be show correctly when use imported font #2512

aimin-git opened this issue Sep 28, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@aimin-git
Copy link

aimin-git commented Sep 28, 2021

Describe the bug:

The set on button can't be show correctly when use imported font
The text in label can be shown correctly but the text on button can't.

To Reproduce:

Steps to reproduce the behaviour:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Screenshots:

image

Example code:

func init() {
fontPaths := findfont.List()
for _, path := range fontPaths {
fmt.Println(path)
//楷体:simkai.ttf
//黑体:simhei.ttf
//PingFang-Regular.ttf
if strings.Contains(path, "PingFang-Regular.ttf") {
os.Setenv("FYNE_FONT", path)
break
}
}
fmt.Println("=============")
}

Device (please complete the following information):

  • OS: Windows10
  • Version: <!-- [e.g. 5.10.2, 10.13 High Sierra or 14.2]
  • Go version: 1.16.6
  • Fyne version: Fyne 2.1.0
@aimin-git aimin-git added the unverified A bug that has been reported but not verified label Sep 28, 2021
@andydotxyz
Copy link
Member

You have not provided any information about Fyne version, etc - please fill in the bug report template so we can help.

@andydotxyz andydotxyz changed the title The set on button can't be show correctly when use imported font The text on button can't be show correctly when use imported font Dec 7, 2021
@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Dec 7, 2021
@andydotxyz andydotxyz self-assigned this Dec 7, 2021
@andydotxyz andydotxyz added this to the Fixes (v2.1.x) milestone Dec 7, 2021
@andydotxyz
Copy link
Member

I expect you see these errors in the console as well:

FYNE_FONT=~/Downloads/PingFang\ Regular.ttf go run .
2021/12/06 19:34:00 Fyne error:  Error loading specified font
2021/12/06 19:34:00   Cause: open /Users/andy/Downloads/PingFang Bold.ttf: no such file or directory
2021/12/06 19:34:00   At: /Users/andy/Code/fyne/theme/theme.go:626
2021/12/06 19:34:00 Fyne error:  Error loading specified font
2021/12/06 19:34:00   Cause: open /Users/andy/Downloads/PingFang Italic.ttf: no such file or directory
2021/12/06 19:34:00   At: /Users/andy/Code/fyne/theme/theme.go:626
2021/12/06 19:34:00 Fyne error:  Error loading specified font
2021/12/06 19:34:00   Cause: open /Users/andy/Downloads/PingFang BoldItalic.ttf: no such file or directory
2021/12/06 19:34:00   At: /Users/andy/Code/fyne/theme/theme.go:626

Clearly it expects other fonts to be available at the moment.
We could probably fall back to regular if the others are not found.

andydotxyz added a commit to andydotxyz/fyne that referenced this issue Dec 7, 2021
If we load the first custom font use it as fallback instead
This means that other languages can provide just regular font

Fixes fyne-io#2512
andydotxyz added a commit to andydotxyz/fyne that referenced this issue Dec 7, 2021
If we load the first custom font use it as fallback instead
This means that other languages can provide just regular font

Fixes fyne-io#2512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants