quasilyte/ebitengine-resource

Font Suggestions

mcarpenter622 opened this issue · 1 comments

Hey! I quite like this library you've put together, but I think the GetFont could be a bit more useful. Right now you have to specify the font size and you cache the face. I want to suggest you cache the font object instead and modify your GetFont to pass in the size and optionally lineHeight.

The reason I am suggesting this is there are cases where for my games, I want to allow the user to specify the font size. If I use this library as is, I would have to define every possible size from the get-go, Additionally if I want x sizes currently, I would be loading the font file x times.

If you want I am more than happy to put together a PR with what I am thinking?

Given that your library does more than just fonts, I'd love to switch but how it is now is a bit too inflexible.

Here is an example interface from my own font library:

func (fm *FontManager) GetFace(name string, size float64) (font.Face, error) {

func (fm *FontManager) GetFaceWithSpacing(name string, size float64, lineHeight float64) (font.Face, error) {