Re: render 3 glyphes into the one buffer

Alexei Podtelezhnikov <[email protected]>
Newsgroups gmane.comp.fonts.freetype.user
Message-ID <CAJU=AjWa5ftSfVCk9weiT4WQ06=839R6fzoUGccMKYYg30Pcmg@mail.gmail.com>
On Tue, Aug 3, 2021 at 9:32 AM Vitaliy Fadeev <[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.