freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] Rendering text placed on a curve.


From: Thomas Hudson
Subject: Re: [Freetype] Rendering text placed on a curve.
Date: Thu, 30 Aug 2001 12:12:07 -0700

Tomasz Wegrzanowski wrote:
> 
> I'm thinking about rendering text placed on a curve.
> Bitmap fonts would be useless for this purpose,
> so I'm thinking about using libfreetype.
> Is it possible to call libfreetype to make unaligned outline,
> then transform this outline in main program, and then
> call libfreetype to align these points and make raster
> image of glyph ?
> Is there any project that actually renders text on curve ?
> 
We do something similar in Gobe Productive (http://www.gobe.com). 
This is pretty easy. When you load a glyph specify outline mode to
keep freetype from rendering to bitmaps, do your
transformation, and then render to bitmaps. The following
code does that, but we're using the caching system, so the
glyph loading will be different if you're not using the cache.

  FTC_Image_Desc desc;
  desc.font.face_id = reinterpret_cast<void*>(faceID);
  desc.font.pix_width = desc.font.pix_height = Size;

  FT_Glyph glyph;
  FT_Glyph glyph_from_cache;
  desc.image_type = ftc_image_outline;
          
  
FTC_Image_Cache_Lookup(fs->GetImageCache(),&desc,glyph_index,&glyph_from_cache);
  FT_Glyph_Copy( glyph_from_cache, &glyph );

  FT_Glyph_Transform( glyph, &Matrix, 0 );

  FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, 0, 1 ); // destroy 
original image 
  return (FT_BitmapGlyphRec_*) glyph;


Thomas



reply via email to

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