FontStashSharp

I would to introduce FontStashSharp, which is well-known(mostly within MG discord) text rendering library.
Its main features:

  • Loading ttf fonts at the run-time
  • Glyphs are rendered on-demand on the texture atlas. Hence the library doesnt require to explicitly specify required character ranges during the font creation.
6 Likes

FontStashSharp got simple rich text support: Rich Text · FontStashSharp/FontStashSharp Wiki · GitHub

1 Like

That’s awesome, thanks for your hard work!

1 Like

Thank you! this is really good, I’ve been testing it in the past few days and it works pretty well even under heavy load, I will replace all my font logic with this project now, this is what I was looking for quite many years!.

1 Like

rds1983,
Do you know how to get the size of a text that gives the baseline of the text?
For example if I use “Hello” measure string will give me an Y value, but if I try to print “jello” because j goes below the baseline I get a different Y value than Hello, though I want to print both at the same Y value.

I do not want to make different logic for letters that go below the baseline of the text, any idea how can I achieve a correct baseline with FontStash?

SpriteFontBase.LineHeight?

1 Like

Thanks!, looks like that one did the trick. Thought the MeasureString always returns the exact font dimension, I think it may be more useful if there is a flag to return the height based on baseline. That was the reason for my fonts to not align properly everywhere and I was trying to understand why it failed with some words until I notice the baseline. The same thing happened with the default SpriteFont.