[Cuis] Fixed-Width Font

Dan Norton dnorton at mindspring.com
Sun Jul 19 20:13:35 CDT 2015


On 19 Jul 2015 at 10:31, Juan Vuletich wrote:

> On 7/18/2015 3:37 PM, Dan Norton wrote:
> > On 11 Jul 2015 at 13:40, Juan Vuletich wrote:
> >
> >> Hi Folks,
> >>
> >> It is not too hard to build new StrikeFonts. You need to build,
> by
> >> hand,
> >> files like the ones in here:
> >>
> https://dl.dropboxusercontent.com/u/13285702/BitmapDejaVuAllSizes.zi
> >> p
> >> and learn a bit about stuff like #installDejaVu2 . Maybe it was
> with
> >> this method and the files in this zip that built the existing
> >> instances
> >> of StrikeFont. Not sure.
> >>
> > That's intrigueing but I can't reproduce it. Maybe the .bmp but
> where did you get the .txt?
> >
> >   - Dan
> 
> I wrote them with a text editor. Check #installDejaVu2 and really
> try to 
> understand how StrikeFonts work and how they are built with this
> method. 
> Maybe you'll become enlightened.
> 

A StrikeFont consists of a characterToGlyphMap, xTable, glyphs, name, and several scalars. 
StrikeFont class methods create fonts by processing file pairs assumed to be in the 
"AAFonts" subdirectory. For example:

DejaVu Sans Oblique 14.bmp
DejaVu Sans Oblique 14.txt

Is one such pair providing the italic (oblique) style for 14-point size. There is a pair for every 
font size and style: base, bold, italic, and bold italic. Therefore a font such as "DejaVu Sans" 
which is available in the size interval 5 to 24 requires 160 files. The file names are stylized 
and encoded in the StrikeFont class methods.

Glyphs come from the .bmp file. The .txt file is a string of numbers; the first three specify 
pointSize, ascent, and	descent. The rest of the numbers in the .txt file are used to form the 
xTable, which is the index into the glyphs for a character. The characterToGlyphMap is an 
array of 256 entries which map a character's ascii value to the xTable and thence to the 
glyphs.

The bold, italic, and bold italic styles are stashed as derivatives of the base and not 
selectable from the current menus.

StrikeFont is a subclass of AbstractFont, which has class variables AvailableFonts and 
DefaultFont.

If it can't find a file, StrikeFont will loop.

In regard to creating the .bmp and .txt files, you say, "I wrote them with a text editor." Please 
tell me which text editor you used. None of mine do that.

 - Dan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150719/abeacdea/attachment-0004.html>


More information about the Cuis mailing list