Ideal D GUI Toolkit
Kiith-Sa
kiithsacmp at gmail.com
Mon May 20 17:21:53 PDT 2013
On Tuesday, 21 May 2013 at 00:05:21 UTC, Diggory wrote:
> On Monday, 20 May 2013 at 23:40:34 UTC, Andrej Mitrovic wrote:
>> On 5/21/13, Adam Wilson <flyboynw at gmail.com> wrote:
>>> Sub-pixel font hinting. Almost no games use this, and almost
>>> every OS
>>> toolkit does.
>>
>> There used to be a nice article about font rendering in OpenGL
>> (methinks) here:
>> http://h3.gd/dmedia/?n=Tutorials.TextRendering1
>>
>> But the link is dead. Most h3r3tic links are dead, not even
>> archive.org has them.
>
> Generally the idea is to pack the characters into a texture and
> then render from that - it's very fast as you don't have to
> switch textures which is relatively slow. There are a few
> different ways of representing the characters (for large text
> signed distance maps seem to be currently the state of the art)
> while for small text a simple single channel alpha map is good
> and fast.
>
> TBH the rendering itself is fairly simple, the hard part is the
> layout, glyph conversion and kerning. It seems like the new
> std.uni module actually does some of the glyph conversion which
> is nice.
>
> Another technique that might be worth looking into is simply
> getting the OS to render the text as it will be displayed to a
> texture and then it's just a case of blitting that to the
> screen. With some caching that could be efficient enough, most
> gui text does not change very often, otherwise you wouldn't
> have time to read it...
The code I linked to takes care of glyph positioning/kerning/etc;
although I didn't test it with e.g. asian languages, and there
might be bugs to work out there.
More information about the Digitalmars-d
mailing list