[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: render 3 glyphes into the one buffer
From: |
Alexei Podtelezhnikov |
Subject: |
Re: render 3 glyphes into the one buffer |
Date: |
Tue, 3 Aug 2021 09:51:44 -0400 |
On Tue, Aug 3, 2021 at 9:32 AM Vitaliy Fadeev <vital.fadeev@gmail.com> wrote:
>
> On Вт, 2021-08-03 at 08:47 -0400, Alexei Podtelezhnikov wrote:
> > > Question 1: Possible to render glyphs directly into te one big
> > > bitmap ?
> >
> > If you are ready to manage the buffer yourselves and carefully track
> > the pen coordinates for proper layout, you might be able to use
> > FT_Outline_Render with FT_RASTER_FLAG_DIRECT and some callback
> > function.
> >
> > https://www.freetype.org/freetype2/docs/reference/ft2-outline_processing.html#ft_outline_render
> >
> > This is what a lot of games use when they do not want to rely on a
> > heavy layout engine like Cairo.
>
> Alexei Podtelezhnikov, thank you!
>
> I see FT_Outline_Render. I see the flag FT_RASTER_FLAG_DIRECT.
>
> I will to pass the bitmap ( FT_Bitmap ) via `params.target` (
> FT_Raster_Params ). It good.
> How to set render offset ( left, top ) ?
>
> I think,
> I can use `FT_Bitmap.buffer` for set start position in buffer, and
> I can set `FT_Bitmap.pitch` to ny_buffer.width.
Sounds good. Whatever works...
FT_RASTER_FLAG_DIRECT is an option but you do not have to use it. It
depends how/when you plan to color the text and the background
(composing) or what is the pixel mode in your buffer.