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

When will ttc fonts be supported? #3799

Closed
2 tasks done
sh1luo opened this issue Apr 8, 2023 · 3 comments
Closed
2 tasks done

When will ttc fonts be supported? #3799

sh1luo opened this issue Apr 8, 2023 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@sh1luo
Copy link

sh1luo commented Apr 8, 2023

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

I noticed the previous issues, someone mentioned this problem, and some developers said that they will fix it in the next minor version, but I found that it will still panic directly in version v233

How to reproduce

var (
	HmTTf []byte
	//go:embed msyh.ttc
	backup []byte
)

func init() {
	fontPaths, err := findfont.Find("msyh.ttc")
	if err != nil {
		HmTTf = backup
		return
	}

	HmTTf, err = os.ReadFile(fontPaths)
	if err != nil {
		log.Logger.Println(err)
	}
}
func (*CustomerTheme) Font(s fyne.TextStyle) fyne.Resource {
	return fyne.NewStaticResource("font", fonts.HmTTf)
}

Screenshots

2023/04/09 08:17:27 Fyne error: font load error
2023/04/09 08:17:27 Cause: unsupported font format
2023/04/09 08:17:27 At: C:/Users/zhonger/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/font.go:150
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x4ec pc=0x7ff7fd7549e0]

goroutine 1 [running, locked to thread]:
github.com/benoitkugler/textlayout/fonts/truetype.(*Font).Upem(0x1?)
C:/Users/zhonger/go/pkg/mod/github.com/benoitkugler/[email protected]/fonts/truetype/metrics.go:34
github.com/benoitkugler/textlayout/harfbuzz.NewFont({0x7ff7fdf2b078?, 0x0})

Example code

var (
	HmTTf []byte
	//go:embed msyh.ttc
	backup []byte
)

func init() {
	fontPaths, err := findfont.Find("msyh.ttc")
	if err != nil {
		HmTTf = backup
		return
	}

	HmTTf, err = os.ReadFile(fontPaths)
	if err != nil {
		log.Logger.Println(err)
	}
}
func (*CustomerTheme) Font(s fyne.TextStyle) fyne.Resource {
	return fyne.NewStaticResource("font", fonts.HmTTf)
}

Fyne version

223

Go compiler version

1.19+

Operating system and version

win10

Additional Information

No response

@sh1luo sh1luo added the unverified A bug that has been reported but not verified label Apr 8, 2023
@Jacalz
Copy link
Member

Jacalz commented Apr 8, 2023

There is likely a better answer (I have not quite read into how the fonts are handled) but I think #3245 will have to be closed before then. It is not currently supported in v2.3.3 as far as I know.

FYI: We appreciate that you opened this issue but I just want to say that we prefer to use discussions for questions and would appreciate if you use that next time. The issue tracker is intended for bug reports and feature requests. I think the bug part of might be a duplicate of the issue mentioned above.

@andydotxyz
Copy link
Member

I noticed the previous issues, someone mentioned this problem, and some developers said that they will fix it in the next minor version

It would be better to follow up on the ticket you found. Which I suspect is the one @Jacalz linked. Opening a new issue to ask about an open one doesn't help us get it done.

@sh1luo
Copy link
Author

sh1luo commented Apr 9, 2023

i know, thx

@andydotxyz andydotxyz closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2023
@andydotxyz andydotxyz added duplicate This issue or pull request already exists and removed unverified A bug that has been reported but not verified labels Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants