views:

285

answers:

1

I want to render font in a way that takes account of the current transforms and similar settings, especially the projection transform and viewport.

I'm thinking that the best way to do that is to have an off screen surface to render the text to, and then render that surface where I really want the text.

However I'm not certain on a number of aspects of this solution.

  • Is this the best way to go about it at all?

  • Are there far better free font renderers around that id be better off spending my time with that allow such things. I see alot of people complaining about the d3dx font interfaces for various reasons, but never a link to a better unicode capable renderer...?

  • Is there any advantage to useing certain surface formats and/or surface sizes (eg always using the smallest possible rather than some standard large one, which requires the extra step of trying to work the size out...)

+1  A: 

Yeah, render to texture and then drawing a textured quad to orient and position the text is going to be the easiest way to realize this functionality.

As for D3DX text renderers, it really depends on which SDK you are using. DirectWrite (only for Windows 7 and Vista) will provide a higher quality text rendering approach for applications that need high quality text rendering in a manner that is interoperable with Direct3D.

You can of course do your own rasterization. There are font rasterization engines out there that are open source that could be repurposed for this need, but we're talking tons of coding here for a benefit that may not be distinguishable enough to warrant the development expense.

Having said that, there's a completely new alternative available to you with Direct3D and shaders, provided that you have access to the glyph outlines as curve data. The idea is to use the shader to rasterize the text and store the curve definitions in the vertex stream and associated textures. Try looking at this paper, which describes the technique.

legalize