Is there any downside to using Graphics.DrawString
to render a (rather static) bunch of text to an offscreen bitmap, convert it to a Texture2D
once, and then simply call SpriteBatch.Draw
, instead of using the content pipeline and rendering text using SpriteFont
? This is basically a page of text, drawn to a "sheet of paper", but user can also choose to resize fonts, so this means I would have to include spritefonts of different sizes.
Since this is a Windows only app (not planning to port it), I will have access to all fonts like in a plain old WinForms app, and I believe rendering quality will be much better when using Graphics.DrawString
(or even TextRenderer
) than using sprite fonts.
Also, it seems performance might be better since SpriteBatch.DrawString
needs to "render" the entire text in each iteration (i.e. send vertices for each letter separately), while by using a bitmap I only do it once, so it should be slightly less work at the CPU side.
- Are there any problems or downsides I am not seeing here?
- Is it possible to get alpha blended text using spritefonts? I've seen Nuclex framework mentioned around, but it's not been ported to Monogame AFAIK.
[Update]
From the technical side, it seems to be working perfectly, much better text rendering than through sprite fonts. If they are rendered horizontally, I even get ClearType. One problem that might exist is that spritesheets for fonts are (might be?) more efficient in terms of texture memory than creating a separate texture for a page of text.