[GRASS-dev] GRASS/KerGIS fonts: hershey revival

tlaronde at polynum.com tlaronde at polynum.com
Mon Oct 30 20:21:32 EST 2006


Hello,

This is a subject I think both GRASS GPL and KerGIS could share.

Indeed, actually I need (and I play) with the concept of a library
of symbols to show graphically what some (vector) geometrical point
nature is---to display a symbol on a geometrical point (say an
electrical symbol if the site is electricity related, a lamppost and so
on).

The classical (and logical) way to do it is using a library of
individual graphical groups. That is a font with special glyphs. Since
the DRAWLIB (is RASTERLIB in GRASS GPL) already knows how to color,
rotate and scale glyphes everything is potentially here.

As an example, I work on generating a "font" (library of symbols) when
importing DXF (the BLOCKS) and assigning a group (KerGIS name; is/was
cat in GRASS) to the point where the BLOCK is placed.

So I needed to understand how fontes were handled.

Since the hershey's fonts are _vectorial_ (this is great by itself).
Since vectorial is straightforward to translate in postscript, a way to
describe the elements, to compile the font from a description (the
current one will be extended to a pseudo Vectorial Font Description---
there is BDF for bitmap from Adobe/X Consortium so you get the idea) 
and to be able to handle it was needed. 

This will indeed replace the old icons stuff in KerGIS.

I have studied the fonts handling and I have (already) fix some errors
(in spacing [see the image on the kergis website], in the sparse index 
etc.), extended the binary format
(that was lacking some informations), suppressed the ad hoc ASCII
shifts so that the used fonts have glyphes corresponding to latin1
code (no, there are no accented letters; but should not be difficult
to generate à la TeX virtual font) and I have already resurrected
or modified programs to see what's going on.

The good news: I have put all the representations of the glyphs in a
directory on the http://www.kergis.com/ server---the two thousands less
or more! I have used a program found in the sources and that display
them on the... console (and I like to know the original author; the
only mention, in a file in the same directory, is "jim_stuff"; I think
this is James Westervelt, but I'm unsure, and I'd like to give proper
credit to the original author; if someone knows, please tell!).

But since I'm already able to select, compile and extract, I have put
an X image (generated in KerGIS with the xdriver and DRAWLIB commands)
on some glyphs that are there (just go to http://www.kergis.com/ the
image is in the news section, at the beginning).

And wow! This is great.

I think that GRASS GPL would benefit too from having a standalone set
of fonts with Kanji, Hiragana and Katakana and more, not depending
upon external sets (and there is the possibility to have something
really good: everything is potentially here including ligatures,
mathematical symbols [could do TeX in part]).

What has to be done, is to map the glyph number in the occidental and
oriental sets to some well-known encoding. That's where the GPL GRASS
user base, specially for the oriental set, could help.

This means visualizing the glyphes images (found in
http://www.kergis.com/fonts/hershey/{oc,or}/) and mapping them.

The two files:

http://www.kergis.com/fonts/hershey/oc/hershey_oc.txt
http://www.kergis.com/fonts/hershey/or/hershey_or.txt

give the ranges of the glyph (meaning that the consecutive ranges are
a distinct subset: start by identifying a subset. First what language,
mapping to a standard encoding, and finding the canonical size and
type of the font).

The two vertical bars are the left margin and the right margin (there
can be some glyphs that extend outside the margins): there are not
part of the glyph drawing by itself but give its position relative to
the previous and the next.

I have already modified the binary format of the fonts (and the KerGIS
DRAWLIB) and will extend it further. But once this is done, GRASS could 
use it (BSD and GPL are compatible). And, since I'm the only developer
on this part, if you really mind about the licence, I could give you
a GPL version... 

Am I the only one to feel like a marvelling child discovering treasures
in the CERL code?

Cheers,
-- 
Thierry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
                 http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C




More information about the grass-dev mailing list