Smart font for ISWA 2010
Eduardo Trápani
etrapani at GMAIL.COM
Wed Dec 5 15:11:58 UTC 2012
Hi!
I've got some good news! I finally got graphite to render the binary
signwriting string, meaning that we will be able in the future to work
with signwriting as text rather than as images.
You can check it out here[1]. You should look at that page with
Firefox[2], having enabled graphite first (it is just a simple
configuration change[3]).
It's pretty exciting, I can now even copy/paste SW from Firefox to
LibreOffice! The partial font for that page can be downloaded from here[4].
There are some issues pending, I'll try to list them all here. It might
get a bit long and technical, but I'd rather document it.
Graphite
--------
Graphite is a "smart font" system developed specifically to handle the
complexities of lesser-known languages of the world.[5] It allows us to
attach a small "program" to the font. That program can then choose the
right set of glyphs according to the input text, considering context,
ligatures, etc. It does reordering, substitution, insertion and
positioning.
Internals overview
------------------
A SW unicode string is be something like:
[Structural
marker][base_symbol1][fill1][rotation1][x1][y1][base_symbol2][fill2][rotation2][x2][y2]...
The graphite program (made of a set of rules) substitutes the structural
marker with a space. That space character will be used as the canvas of
the new sign.
[space][base_symbol1][fill1][rotation1][x1][y1][base_symbol2][fill2][rotation2][x2][y2]...
Since we cannot do math on glyph or unicode numbers inside the rules, a
workaround is to "fold" fill and rotation into another set of
characters. To do that all combinations have to be spelled out, but
it's only 96 of them, so that's not a big deal.
[space][base_symbol1][fr1][x1][y1][base_symbol2][fr2][x2][y2]...
Then, using fr1/fr2/... as indexes, and listing all variants for each
symbol, we can finally see the right symbol, rotated and filled.
[space][symbol1][x1][y1][symbol2][x2][y2]...
Positioning means some more glyph classes and the need to translate
coordinates. And then we have the actual sign writing with the [space]
as the base character and [symbol1] and [symbol2]... correctly positioned.
Problems
--------
* There seems to be a maximum number of glyphs for a font inside Firefox
(I've only tested Linux). For me it was around 32500, and that is not
enought for a full ISWA graphite font. I haven't had time to debug that
yet. So, building a full ISWA font is possible, but it wouldn't work
right now. Also, adding more symbols means adding more classes to the
graphite program, but that seems to be less of a problem.
* Graphite internally only deals with glyphs, so for SW we need a glyph
for each one of the symbols and their alternate forms (fill and
rotation) *and* for things like numbers, rotations, fills and the like.
Sharing glyphs should work and would save some space but Graphite does
not deal with those shared glyphs consistently, so, for now I've decided
to create a new glyph for each unicode point that needs to be dealt with.
That's why I have a program that reads a document, lists the SW unicode
characters and then builds a partial font just for those base symbols,
although it does include all numbers, fills and rotations characters and
the full set of variations for those symbols.
* Firefox uses the Graphite engine and shows the text right, but it has
problems with the height. You can see at the example page[1] that the
text overflows the container. But the problem is more serious when
looking at the ASL Wikipedia main page[7] (an almost identical version
with images is here[8]). It might be solvable from Graphite ... I don't
know yet. I'm just using positioning, maybe "kerning" the character
will help.
* Fonts and fillings. I asked about the white fillings and I understand
they are necessary. As of now Graphite seems to only work on TTF and
that means that I cannot import the white fillings. A Postscript Type3
font can be created with the right fills, but I'm not sure which
application would actually benefit from it right now.
* Structural markers. The program does the same for the three lanes or
sequence. And it is not using the maximum box precomputed size. With
some examples on how multiple-lane sw text should look like I can give
it a try. For the moment it is as if only one lane was present. And
the maximum number of components in a sign is seven (that can be easily
changed with little impact).
* It's so much fun! I had my first contact with Graphite, FontForge and
font creation and design. And I had to finally learn some python. The
program that creates the font and the graphite source program can be
downloaded from here[6]. I'm a beginner in these areas, please let me
know about improvements and fixes. Let's say the code works but I'm not
specially proud of it ;).
I'd like to specially thank Steve for the code that helped me start this
and for always being there for all the technical questions on SW. And I
just don't know how to thank Valerie for everything ...
Seeing the first sign drawn in Firefox from SW text was a magical
moment. I hope we can do a lot more from here. It feels great to be
able to do something for SW!
Friendly, Eduardo.
[1] http://programoj.esperanto.org.uy/sw/mini.html
[2] http://firefox.com
[3]
http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_firefox#cb8275a7
[4] http://programoj.esperanto.org.uy/sw/iswa.ttf
[5]
http://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_home
[6] http://programoj.esperanto.org.uy/sw/scripts.zip
[7] http://mapache.unesco.org.uy/sw/Main_page_2.html
[8] http://ase.wikipedia.wmflabs.org/wiki/Main_Page
More information about the Sw-l
mailing list