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

Hope to load more than one font resources into theme, for supporting various kind of chars, like an font family could do #4864

Closed
2 tasks done
ZSA233 opened this issue May 22, 2024 · 2 comments

Comments

@ZSA233
Copy link

ZSA233 commented May 22, 2024

Checklist

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

Is your feature request related to a problem?

I couldn't load both lucon.ttf(only support latin char) font and simli.ttf(support simple chineses char) font to implement "lucon.ttf" latin-style(more priolity) and simple chineses char(except latin char)

Is it possible to construct a solution with the existing API?

No response

Describe the solution you'd like to see.

f1 = loadMeasureFont(theme.TextFont())
f2 = loadMeasureFont(theme.DefaultTextFont())

painter.CachedFontFace only load costom theme font resource(f1) and built-in font resource(f2).

Is it possible to load font family resource like this

type MyTheme struct {
	fyne.Theme
}

func (m *MyTheme) FontFamily(ts fyne.TextStyle) []fyne.Resource {
	return []fyne.Resource{
		assets.FontResource,
		assets.FontResource1,
	}
}

painter.CachedFontFace impl could be like

for _, f := range theme.TextFontFamily() {
	faces = append(faces, loadMeasureFont(f))
}
@andydotxyz
Copy link
Member

Internally this will be in place for 2.5 to look up system fonts.
Maybe test develop branch and see if this is still needed?

@ZSA233
Copy link
Author

ZSA233 commented May 24, 2024

Internally this will be in place for 2.5 to look up system fonts. Maybe test develop branch and see if this is still needed?

@v2.4.6: It works for me with lang char, and it really looks more intuitive for looking up system fonts.

@ZSA233 ZSA233 closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants