Download demo project - 51 Kb
Download FontEdit sample program - 68 KbDownload Font data files - 156 Kb
Recently when building a GIS display system I ran into the problem of displaying
characters at many different sizes, rotations (escapments), and in several typefaces
all in the same view. Unfortunately the redraw performance I was able to obtain using Windows'
font routines was not very good. Reaching back to my past (and definitely showing
my age) I decided to use the venerable "Hershey" vector fonts.
All of the font management and display is wrapped up the class
the use of which it illustrated in the FontDemo
program included. The only method of any real consequence is:
CDC * pDC,
NOTE: For this article I hard-coded the path so that the font definition data
(found in FontData.zip) must reside in
C:\HersheyFonts. In the real system this is
stored on a server with the GIS data.
The original Hershey font character codes do not match well ASCII.
I have built a translation table that maps ASCII character and font to
a Hershey character. The included fonts are:
I have also included a crude font editor that lets you edit the
vertices and the translation table. To edit a character right
click on it in any view. To assign a hershey font to a ASCII
font family pairing select the character in the numeric view and
select "index save" from the menu. Switch to Xlated view and
select the target cell, then select "Assign Index".
The font data resides in two files. The vector data, and the translation table
I have supplied both the runtime version, and a human readable version in CSV
format for those who wish to use them. The
SMFontUtils class provides a method
to convert from the CSV to the runtime. Again, please note that for
the purposes of this article the font definition data (FontData.zip) must be