Re: FT Cache Subsystem: Custom caches
Hi Kelvin If you only interested in subpixels shifts and intend to cache 3 positions, you can achieve using LCD rendering and https://freetype.org/freetype2/docs/reference/ft2-lcd_rendering.html#ft_library_setlcdgeometry. It is apparent that LCD rendering is essentially 3 traditional antialiased bitmaps produced for shifted outlines and stacked together. Therefore, you have it already for 1/3-pixel shifts by default. Because everything is periodic, you can continue with the LCD output and clever reading frame shifts for subpixel positioning too. Theoretically, this should work. There is also https://freetype.org/freetype2/docs/reference/ft2-sizing_and_scaling.html#ft_set_transform . Perhaps you should wrap it into https://freetype.org/freetype2/docs/reference/ft2-cache_subsystem.html#ftc_face_requester. Alexei
Re: FT Cache Subsystem: Custom caches
Hi, sorry for the confusion; I think its better if I explain my current approach first: 1. I create a FTC_Manager, FTC_CMapCache and FTC_ImageCache, and set them up. 2. I query a glyph ID from FTC_CMapCache. 3. I get a glyph image (almost always an outline in my case) from FTC_ImageCache. 4. I copy the FT_Glyph and perform translation and other transformation on it. 5. I rasterize the transformed FT_Glyph. 6. I use the rasterized bitmap. I wasn't able to cache the rasterized glyph because FTC_SBitCache doesn't support transformations. I am looking to do one of these things: 1. Being able to apply transformations in FTC_SBitCache. The main reason I can't use FTC_SBitCache is that I need to modify the outline. I need to translate it for subpixel positioning, italicize, embolden and apply other transformations before rasterizing. I think this is a niche use case, so I'm not fully expecting the cache subsystem to support this. 2. Being able to extend / implement my own cache types. Alternatively, I want to be able to implement a custom cache type, based on FTC_Manager. Based on the draft document in the previous email, this was possible, but didn't make it to release. This new cache would behave like FTC_SBitCache, but supports the various operations I need to do on the glyph outlines before rendering. I hope this clears things up. I was looking for ways to avoid rolling my own cache if possible. Thanks. Kelvin.
Re: FT Cache Subsystem: Custom caches
> I'm trying to use FreeType cache subsystem to render glyphs. I tried > using FTC_SBitCache but I need to modify the outline before > rendering (translate and transform) so I could only use > FTC_ImageCache, modify the outline and render it. > > Is there a way to extend the cache mechanism to create my own cache > that supports all these features? Extend in which way? It's not clear to me what you want to cache... Werner
FT Cache Subsystem: Custom caches
Hi, I'm trying to use FreeType cache subsystem to render glyphs. I tried using FTC_SBitCache but I need to modify the outline before rendering (translate and transform) so I could only use FTC_ImageCache, modify the outline and render it. Is there a way to extend the cache mechanism to create my own cache that supports all these features? I Googled and found draft document: http://www.fifi.org/doc/libfreetype6/cache.html It doesn't seem to work now. Are there any way to achieve that, or is this future planned for the future? Kelvin
