[erlang-questions] Erlguten fonts

lloyd@REDACTED lloyd@REDACTED
Sun Apr 26 18:51:58 CEST 2015


Hello,

This is Take 2.

Digging around erlguten source and Google I've discovered nuggets that may point toward an answer to my previous post: e.g. how to add fonts to erlguten. 

I don't have a complete solution yet, but consider this speculative information that points the way and a request for help to resolve outstanding mysteries. I'll write it all up as a blog or some such once I have answer at hand.

1) Font metrics, e.g. glyph widths, etc., are found in *.afm files 

2)  In Ubuntu 14.04 fonts are stored in: 

-- /usr/share/fonts/type1
-- /usr/share/fonts/truetype

3) List /usr/share/fonts/type1/gsfonts, for instance, and you see *.pfb, *.pfm, and *.afm files. 

-- *.pfb are printer binary files
-- *.pfm are printer metric files
-- *.afm are provide font metrics

4) When I open /usr/share/fonts/truetype I see dejavu, a font I happen to like. Listing dejavu, I see DejaVuSans.ttf and related *.ttf files. But no *.afm.

5) But I can convert from *.ttf files using a convenient utility:ttf2afm

http://manpages.ubuntu.com/manpages/precise/man1/ttf2afm.1.html

In my case $ sudo ttf2atm /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf generates a *.afm file. I presume it should be called dejavusans.afm, but not 100% confident.

6) Now, in erlguten/priv/fonts/adobe we see font names. In erguten/priv/fonts/adobe/courier we see courier *.afm files. Open one and you can see what the font metrics look like.

7) There seems to be a necessary directory to these fonts in erlguten/priv/font_locations.

8) Now look in erlguten/src/eg_font_5.erl, say, and you'll see an erlang module with a bunch of font metrics. This raises the question, how do we convert from an *.afm file to a similar erlang font metric file?

9) Clue: (and here I'm very shaky ground) look in eg_afm and note a module called make/2. This appears to be a parser that will do the trick. I haven't tried it yet since I'm clear exactly what the parameters BaseDir and FurtherPath refer to. 

I'd much welcome any corrections or additional information that would span gaps in the road toward adding fonts to erlguten. 

In my view erlguten is a hidden jewel that deserves additional development and documentation. I'm looking toward a web-based GUI in Nitrogen. Would welcome help and will post what I find along the way.

All the best,

Lloyd  



   

-----Original Message-----
From: "Lloyd R. Prentice" <lloyd@REDACTED>
Sent: Saturday, April 25, 2015 10:07am
To: "Erlang Questions" <erlang-questions@REDACTED>
Subject: [erlang-questions] Erlguten fonts

Hello,

I'd love to add a few fonts to erlguten. 

Does anyone know the source of the character width data  represented in the font modules, e.g.
eg_font_1.erl through eg_font_17.erl?

Thanks,

LRP

Sent from my iPad
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions





More information about the erlang-questions mailing list