← Back to team overview

kicad-developers team mailing list archive

Re: Vector fonts

 

--- In kicad-devel@xxxxxxxxxxxxxxx, "Marco Serantoni" <marco.serantoni@...>wrote:

> I were making a couple of experiments with potracelib && system fonts andseems that does its work more or less correctly, now i'm looking to nice way to approximate Bézier curves to segments.

There's a nice algorithm that for conic bezier (the one used by truetype) is more or less three linear interpolations..

http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm

In a nutshell you can either decide to divide the curve in, say 3-4 segments (like for arc during zone computations), or subdivide it recursively until you get the desired 'fit' with a line.

Why are you using potrace? just load the font with freetype and use FT_Outline_Decompose... it gives you the native outline (as lines and beziers). FT_Outline_Render gives you a raster bitmap, but there are easier way to do that...

Something like: FT_InitFreeType, FT_Open_Face, FT_Load_Char, FT_Outline_Decompose... (more or less :D)






Follow ups

References