[HarfBuzz] Computing necessary canvas size to render text
Behdad Esfahbod
behdad at behdad.org
Wed Aug 7 14:53:35 PDT 2013
Hi Tiffany,
On 13-08-07 05:44 PM, Tiffany Bennett wrote:
> I am using harfbuzz + cairo + freetype2 to perform text rendering in my
> project, and I haven't been able to find any functions to help me figure out
> how large of a surface I will need to create in order to fit all the text. I
> ended up writing my own function, but it always creates too small of a surface
> and I'm not sure how to do it correctly.
When you have your glyphs ready, use cairo_glyph_extents. Normally you would
create a 0x0 cairo surface, call your drawing routine which also calculates
text extents, then create a new surface at the correct size and call your
drawing routine to do the actual drawing.
--
behdad
http://behdad.org/
More information about the HarfBuzz
mailing list