RonenNess / GeonBit.UI

UI system for MonoGame projects.
MIT License
467 stars 63 forks source link

Font-less version of GeonBit? #142

Closed Kubrix closed 4 months ago

Kubrix commented 4 months ago

I want to use my own fonts and use GeonBit UI. Is that possible? I dont want to force end-user to install fonts - i have them in /Fonts subfolder

Kubrix commented 4 months ago

Issue reopened. Can I NOT force user to install additional fonts?

RonenNess commented 4 months ago

That's a monogame limitation, not specific to geonbit.ui. I think you can pre build the spritefont and provide the xnb files with copy action instead of build, pretty sure that would work.

Ps be sure to use monospace fonts, or some features may not work properly.

Kubrix commented 4 months ago

not specific to geonbit.ui.

Ok but with https://github.com/rds1983/Myra/wiki i just provide .ttf with my prohgram and load fonts like this: https://github.com/FontStashSharp/FontStashSharp/wiki/Using-FontStashSharp-in-MonoGame-or-FNA#basic-usage

So i dont have to install them

RonenNess commented 4 months ago

Looks cool! You can use that lib to load the font and set the Resources instance fonts:

https://github.com/RonenNess/GeonBit.UI/blob/master/GeonBit.UI/Source/Resources.cs#L269

Didn't try it but I think it should work. That said, it would be a lot more easier to just pre-build your font, since you won't really utilize all the cool features FontStashSharp actually provides.

BlizzCrafter commented 4 months ago

Please also look at the open PR's https://github.com/RonenNess/GeonBit.UI/pull/138 and https://github.com/RonenNess/GeonBit.UI/pull/139.

You can use the font path in your .spritefont.xml like this:

<FontName>../../../../Fonts/Bitstream Vera Sans Mono Bold.ttf</FontName>