Closed ajstarks closed 9 months ago
I don't think we can rely on magic places, or even filesystem in general if this should work on mobile.
I would propose instead a TextFont fyne.Resource
field which means it could be loaded from various different places and passed, already loaded, into the app? That way it could be (recommended?) bundled into the app binary.
It doesn't, however, have the usual font caching or fallback to the latin characters if a lookup fails... I guess that is OK for this purpose though, as the developer has full control over the font they load?
Yes, I agree the fyne.Resource is a better choice.
I don't know exactly how this should be done - but as we review text handling in 2.0 it's a good time to discuss
Seems good to me
Does it now support custom font size for widgets? Generally important information in the design may be different in font size and color. If the widget does not support separate font definition, then it cannot be used.
Does it now support custom font size for widgets?
Widgets use the standard size and colours set by the theme. The canvas
package provides complete flexibility over what you do as there is no semantic meaning to them.
Generally important information in the design may be different in font size and color.
I agree, but this is controlled by widget APIs, not customisation. For example the Title
of a Card
or Button.Importance = HighImportance
allow this differentiation without breaking the concept of a semantic API styled by the current theme.
Remember, if the standard widgets don't do what you want you can insert your own code or just canvas.Text
element - you are not limited to the standard widgets, that is just an easy to use happy-path.
Thank you very much. Canvas.NewText is really easy to use.
This should be covered by the Rich Text proposal at https://github.com/fyne-io/proposals/pull/3/files#diff-eb10bfb4b3ec7c6895fe11638107950db8201a985453fa98eac3c5c0eb6fc674R90
I think we can close this issue as the original request seems to have been resolved.
In addition to this Text.FontSource
now allows you to load font faces outside of the theme definition.
Is your feature request related to a problem? Please describe:
it would be useful to apply an arbitrary font to Text objects rendered on the fyne Canvas
Is it possible to construct a solution with the existing API?
No.
Describe the solution you'd like to see:
Add a field to the fyne/canvas.Text object that points to font resource. The default value can be the sans-serif font used by the current theme.