[Cuis] Fixed-Width Font

Juan Vuletich juan at jvuletich.org
Mon Jul 20 17:33:27 CDT 2015


Hi Dan,

On 7/19/2015 10:13 PM, Dan Norton wrote:
> 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.

Great! You got it all.

> 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.

The bmp files can be created with screen capture program, after entering 
suitable text in it. Maybe you need to stitch several pieces together, 
etc. WRT the txt files, well, the editor didn't do it for me. I wrote 
them. I _typed_ them. Maybe I used some (long lost) code to look for 
white columns separating glyphs, but I'm not really sure. 
#xTallyPixelValue:orNot: and friends are great for this kind of stuff.

In any case, it will be easier for you, as you want a monospaced font. 
Printing something like (32 to: 255) collect: [ :ascii | ascii-32 * 9 ] 
into the file might be enough.

You have all the pieces at hand. it just requires a bit of patience.

Cheers,
Juan Vuletich

>  - Dan
>

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


More information about the Cuis mailing list