[Cuis] Fixed-Width Font

H. Hirzel hannes.hirzel at gmail.com
Mon Jul 20 18:33:31 CDT 2015


https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format

The Glyph Bitmap Distribution Format (BDF) by Adobe is a file format
for storing bitmap fonts. The content takes the form of a text file
intended to be human- and computer-readable. BDF is typically used in
Unix X Window environments.

Squeak contains a BDFFontReader

<class comment>
I am a conversion utility for reading X11 Bitmap Distribution Format
fonts.  My code is derived from the multilingual Squeak changeset
written by OHSHIMA Yoshiki (ohshima at is.titech.ac.jp), although all
support for fonts with more than 256 glyphs has been ripped out.  See
http://www.is.titech.ac.jp/~ohshima/squeak/squeak-multilingual-e.html
.

My class methods contain tools for fetching BDF source files from a
well-known archive site, batch conversion to Squeak's .sf2 format, and
installation of these fonts as TextStyles.  Also, the legal notices
for the standard 75dpi fonts I process this way are included as
"x11FontLegalNotices'.
</class comment>

The URL no longer works, but the Squeak wiki

http://wiki.squeak.org/squeak/696

has more on fonts.

I have loaded BDF fonts into Squeak in the past and I assume the
Squeak StrikeFonts and the Cuis StrikeFonts are still compatible.

--Hannes

On 7/20/15, Juan Vuletich <juan at jvuletich.org> wrote:
> 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
>>
>
>




More information about the Cuis mailing list