[Top][All Lists]

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

Initial pen position in freetype?

From: Andrew Tomazos
Subject: Initial pen position in freetype?
Date: Mon, 20 Jul 2020 17:31:25 +1000

Hi guys, quick user question about freetype...

After drawing a glyph with freetype the pen is advanced as follows:

pen.x += face->glyph->advance.x;
pen.y += face->glyph->advance.y;

(possibly plus a kerning delta)

But my question is, how do you set the initial pen position of the first
character, relative to the upper left bound of the drawing surface?

Setting it to {0,0} isn't correct, as it would draw the first line mostly
above the top of the drawing surface, and too close to the left bound.

I suspect it is some combination of:

struct FT_FaceRec {
  FT_BBox           bbox;

  FT_UShort         units_per_EM;
  FT_Short          ascender;
  FT_Short          descender;
  FT_Short          height;

  FT_Short          max_advance_width;
  FT_Short          max_advance_height;

but it isn't very clear.

Thanks in advance,

reply via email to

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