[vtk-developers] FreeType, Unicode and font rendering

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Oct 12 18:30:50 EDT 2010


Hi,

As part of my work with the charts, and 2D rendering, I have been developing 
new classes to render strings with FreeType in VTK. I have staged a topic that 
I intend to merge tomorrow morning called StringToImage on the VTK topic 
stage. It is able to render Unicode, but the built in fonts do not have any of 
the extended character set (or kerning data).

http://review.source.kitware.com/#q,status:open+project:VTK+branch:master+topic:StringToImage,n,z

At this stage, it would be simplest to add an extra option to add new font 
names as strings, with a full path, and have FreeType2 load the font. The 
embedded VTK fonts continue to work as they have always worked. I am not sure 
if there is a good general approach to getting the paths to installed system 
fonts, and enumerating those available. I imagine there is...Qt does it.

One of the larger benefits at present is to the 2D API, where the font 
rendering is improved, but the range of available fonts is reduced if you were 
previously using the Qt based label render stratedy, as it was previously 
using Qt (in ParaView at least) to render fonts. This meant that a larger 
array of fonts was available to this render strategy.

I will continue to work on improving the font rendering as time is available. 
This work gets quite close to supporting the rendering of extended character 
sets once we can load fonts that have the additional glyphs. I have also 
learnt a lot about the low level rendering routines used in VTK, but decided 
to add a second implementation to avoid the need to maintain backward 
compatibility. Both classes are only intended for internal use.

Thanks,

Marcus
-- 
Marcus D. Hanwell, Ph.D.
R&D Engineer, Kitware Inc.
(518) 881-4937



More information about the vtk-developers mailing list