freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] Vertical offset at font-rendering


From: Christian Demmer
Subject: Re: [ft] Vertical offset at font-rendering
Date: Wed, 20 Dec 2006 19:00:53 +0100

Erik Unger wrote:
>I want to render a font into a 256*256 pixel texture,
>using a grid for 16*16 glyphs.
>
>My renderGlyph() function receives a pointer to the
>upper left corner of the grid-position, so I have to
>move this "pen-position" by glyph->bitmap_top and glyph->bitmap_left
>to align the glyph-bitmaps to the baseline of the grid:

Probably I did not get your problem. Do you want to render text to a
texture, or do you want to cache the glyphs in a texture to render on
screen? I assume the second.

I think the idea is to store bitmap.width * bitmap.rows into the texture
and render at position (left, top) relative to the baseline on
the screen. That would avoid your problems.

There is no direct relation between the size of the bitmap in pixel and
the font size in points or whatever AFAIK.

If you only need a quick hack it may work but in general I think you
will wasting texture storage this way.

In my program I do something similar but I use a stripe of texture,
where all glyphs are posed side by side in x direction, so I only
need to track one dimension.

Hope this helps

Christian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]