freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] glyph metrics don't match bitmap size (2.8.1)


From: Nicolas Jinchereau
Subject: Re: [ft-devel] glyph metrics don't match bitmap size (2.8.1)
Date: Tue, 19 Sep 2017 14:59:29 -0400

> Perhaps we could extend it for the outlines by bailing at
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/smooth/ftsmooth.c?id=39ce3ac499d4cd7371031a062f410953c8ecce29#n301

I think this could work, but the allocation/deallocations should be avoided as well:

http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/smooth/ftsmooth.c?id=39ce3ac499d4cd7371031a062f410953c8ecce29#n285
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/smooth/ftsmooth.c?id=39ce3ac499d4cd7371031a062f410953c8ecce29#n280

I suppose FT_GlyphSlotRec doesn't need 3 extra fields then, and the information can just be put into FT_GlyphSlotRec::bitmap. For some reason, I thought that FT_GlyphSlotRec::bitmap was allocated when the glyph was rendered, but I was mistaken. FT_GlyphSlotRec::bitmap is an instance, and not a pointer.

> Doesn't Skia do GPU-based rendering? Their current workaround is to
> preallocate old-fashioned size, which should be slightly larger or
> identical to what FreeType eventually returns, then they eventually
> adjust dimensions to the actual image,

I don't know, but I need to be able to pack a font atlas tightly to hold all the required characters, and adding 2 pixels of padding to all characters would be wasteful. There is a long and complicated list of things to keep in mind when dealing with font atlases, but long-story-short, being able to perform a layout pass over all the glyphs you want to use without having to allocate or render everything would be a big win.

See first picture for "font atlas"
http://wdobbie.com/post/gpu-text-rendering-with-vector-textures/

If I follow, you'd like to be able to interpolate between the bitmaps.

I'm don't understand what you mean.

> Maybe, LCD rendering and GPU are not a good match and should just be avoided.

I already have it working. The only problem is the performance cost of unnecessarily allocating and rendering the entire character set twice when I create a font atlas. I've been able to avoid this with the code I scraped, but as you've said, future updates could easily break my code, so I would prefer an officially supported option.

Thanks,
   Nick


On Tue, Sep 19, 2017 at 1:39 PM, Alexei Podtelezhnikov <address@hidden> wrote:
On Tue, Sep 19, 2017 at 12:27 PM, Nicolas Jinchereau
<address@hidden> wrote:
> A font atlas is needed for efficient GPU-based text rendering. There has
> been some success in drawing glyphs on the GPU,

If I follow, you'd like to be able to interpolate between the bitmaps.
I think LCD color images are not suitable for this. At least this is
not straightforward, is it? Maybe, LCD rendering and GPU are not a
good match and should just be avoided.


reply via email to

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