You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was thinking of adding a new trait to embedded-graphics named FontSetter which would have a corresponding set_font method similar to the existing CharacterStyle trait.
I've come to a conclusion that in order to support downcasting of various font types that we would need to implement one of the three solutions:
Heap allocation to represent general fonts
Leveraging the type id and using an unsafe block to downcast the font
Implementing an enum of various FontTypes that the embedded-graphics crate would need to depend on
I was thinking the third implementation would be desirable as it wouldn't require heap allocation or unsafe code, but it would result in limited extensibility as future font types would need to update embedded-graphics to update the FontType enum.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello folks - I'm looking to add support to the embedded-text crate to allow for handling multiple types of fonts dynamically within a TextBox. #152
Some font types I would ultimately like to support include:
I was thinking of adding a new trait to embedded-graphics named FontSetter which would have a corresponding set_font method similar to the existing CharacterStyle trait.
I've come to a conclusion that in order to support downcasting of various font types that we would need to implement one of the three solutions:
I was thinking the third implementation would be desirable as it wouldn't require heap allocation or unsafe code, but it would result in limited extensibility as future font types would need to update embedded-graphics to update the FontType enum.
Any feedback would be much appreciated
Beta Was this translation helpful? Give feedback.
All reactions