freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] FTC_ImageCache_Lookup and FT_GlyphSlot_Embolden


From: Werner LEMBERG
Subject: Re: [ft-devel] FTC_ImageCache_Lookup and FT_GlyphSlot_Embolden
Date: Tue, 28 May 2013 22:33:25 +0200 (CEST)

> Right now the code calls FT_Load_Glyph() and then
> FT_GlyphSlot_Embolden() if the style flags for the face don't
> support bold or italic.  However, that function makes use of a glyph
> slot and once I cut over to using FTC_ImageCache_Lookup() I cannot
> use FT_GlyphSlot_Embolden anymore.
> 
> Does anyone have any recommendations on how to achieve equivalent
> functionality when using the image cache feature?  Can anybody point
> me to any code which demonstrates this use case?

`FT_GlyphSlot_Embolden' is a convenience function which calls
`FT_Outline_EmboldenXY' internally.  To access the outline data,
simply cast the `FT_Glyph' object to `FT_OutlineGlyph'.  Maybe
something like this (untested):

  FT_Glyph glyph;
  FT_OutlineGlyph outline_glyph;
  FT_Outline outline;

  glyph = FT_Glyph_Copy(glyph_from_cache_lookup, &glyph);

  if (glyph->format == FT_GLYPH_FORMAT_OUTLINE)
  {
    outline_glyph = (FT_OutlineGlyph)glyph;
    outline = outline_glyph->outline;
    FT_Outline_EmboldenXY(&outline, xstrength, ystrength);
  }

  ...


    Werner



reply via email to

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