Posted on Leave a comment

Notes on RISC-V Assembly Language Programming – Part 17

11 February 2025

Now I can focus on compacting the vector data for the glyphs I need for the project. But first, I have to identify them. This has already been done many times in the past by many people, but I feel that I have to do it myself. Unless I change my mind, which is something I can totally do.

A clever collection of interesting Hershey font information has been published by Paul Bourke:

https://paulbourke.net/dataformats/hershey/

Included in this archive, dated 1997, are two files, romanp.hmp (Roman Plain) and romans.hmp (Roman Simplex). These files contain the ASCII mapping data for the plain and simplex varieties, respectively.

The ‘plain’ subset consists of the smaller glyphs. There are no lower case versions (miniscules). The upper case (majiscules) is repeated in their stead. Some statistics I gathered from the plain subset include:

Statistic       Value   Character
--------------  -----   ---------
Max vertices    38      1225 {
Max width       17      1273 @
Max x           7       1273 @
Min x           -6      1246 ~
Max y           10      1223 [
Min y           -10     1223 [
                -----
Total vertices  764

These glyphs can be encoded with 4 bits for the x coordinate and 5 bits for the y coordinate.

The ‘simplex’ subset contains the larger glyphs, including upper and lower case, numerals and punctuation. They are also much more detailed. Here are the same statistics from the simplex set:

Statistic       Value   Character
--------------  -----   ---------
Max vertices    56      2273 @
Max width       30      613  m
Max x           11      613  m
Min x           -11     613  m
Max y           16      607  g
Min y           -16     719  $
                -----
Total vertices  1303

These larger glyphs can be encoded using 5 bits for the x coordinate and can almost squeeze the y coordinate into 5 bits… almost.

So far we’ve only been using absolute coordinates for these mappings. I wonder how much space we could save by using a relative distance from point to point? Start with an absolute coordinate and then just specify relative motion along each axis?

For the plain set, we get these statistics for relative distances:

Statistic   Value   Character
---------   -----   ---------
Max dx      10      809  \
Min dx      -12     1246 ~
Max dy      20      1223 [
Min dy      -20     1223 [

For the simplex set, we get these numbers:

Statistic   Value   Character
---------   -----   ---------
Max dx      18      724 -
Min dx      -18     720 /
Max dy      32      720 /
Min dy      -32     733 #

So the answer is no, the relative values have a greater range than the absolute values. I find this result entirely counter-intuitive.

Leave a Reply