I remember a conversation on IRC several months ago about someone wanting to implement an SVG interpreter in Lua. He wanted a way to build an elegant, scalable UI using vector graphics. He suggested creating the presentation using thousands of texture frames. It's no surprise that he never started on this project.
It just occurred to me today that WoW already has a very sophisticated vector rendering engine built in; that is, the ClearType2 font rendering engine.
I wouldn't recommend trying to build an entire SVG interpreter using Lua and glyphs in fonts. But for anyone who wants to draw simple shapes (i.e., things that could appear as glyphs in a font) in the UI, they could just save these shapes in a font and use a fontstring to display them on screen. This technique would have limited applications, but could still lead to some interesting results if used in the right situations.
A fontstring gets re-rendered any time it's scaled, and antialiased again for the current screen resolution. ClearType2's built in autohinting even tries to make sure features like thin lines don't disappear completely at small scales. Or if you're already an experienced type designer, you can build your own hints into the fonts to suggest appropriate rendering at different sizes. All of these features can lead to far superior looking results when compared with the simple bilinear filtering done when scaling textures in the UI.
I think you're overlooking the hard upper limit of about 35 points/pixels/whatevers that Blizzard places on the size of font strings, and the fact that this limit applies both to the actual font size you specify in :SetFont, but also to the results of :SetScale. No matter how big a number you pass to either (or both) function, your font string will never display bigger than that limit.
You're absolutely right. At a scale of 1.0, the font appears to be limited to a size of 27. This was probably done as a practical limit to reduce the total number of surface textures needed to display a fontstring after it has been rendered.
I suppose the idea of using fonts for vector graphics would only be useful in even more limited situations than I had originally imagined, and in even in those cases might be less efficient than using a compressed texture. From what I see on screen, fontstrings appear to be rendered and composited in main memory and sent to the video card as RGBA surface textures, which takes 4x more memory in each step and in each location than a DXT3 or DXT5 compressed texture, not to mention the processor cycles needed to actually render the glyphs.
I'll have to chalk this up as another interesting, but limited and inefficient idea.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
It just occurred to me today that WoW already has a very sophisticated vector rendering engine built in; that is, the ClearType2 font rendering engine.
I wouldn't recommend trying to build an entire SVG interpreter using Lua and glyphs in fonts. But for anyone who wants to draw simple shapes (i.e., things that could appear as glyphs in a font) in the UI, they could just save these shapes in a font and use a fontstring to display them on screen. This technique would have limited applications, but could still lead to some interesting results if used in the right situations.
A fontstring gets re-rendered any time it's scaled, and antialiased again for the current screen resolution. ClearType2's built in autohinting even tries to make sure features like thin lines don't disappear completely at small scales. Or if you're already an experienced type designer, you can build your own hints into the fonts to suggest appropriate rendering at different sizes. All of these features can lead to far superior looking results when compared with the simple bilinear filtering done when scaling textures in the UI.
I suppose the idea of using fonts for vector graphics would only be useful in even more limited situations than I had originally imagined, and in even in those cases might be less efficient than using a compressed texture. From what I see on screen, fontstrings appear to be rendered and composited in main memory and sent to the video card as RGBA surface textures, which takes 4x more memory in each step and in each location than a DXT3 or DXT5 compressed texture, not to mention the processor cycles needed to actually render the glyphs.
I'll have to chalk this up as another interesting, but limited and inefficient idea.