Skip to content

Revised - How to add OpenSource TrueType fonts to Erlang app

Featured Replies

Hello,

I'm just delving into font technologies, so please forgive whatever ignorance demonstrated by my question.

I'm modifying and extending an Erlang application that generates PDF files:

https://github.com/hwatkins/erlguten

Currently it supports 13 Adobe Type I fonts. I'd like to add OpenSource TrueType fonts. To do this, I need to end up with modules that looks something like this:

https://github.com/hwatkins/erlguten/blob/master/src/eg_font_7.erl

NOTE: You can open *.erl files with any text editor.

In other words, I need to convert TrueType font metrics into the format illustrated in this file.

ErlGuten has a conversion module that may or may not help:

https://github.com/hwatkins/erlguten/blob/master/src/eg_afm.erl

Googling galore, I find many references to TrueType .ttf files, but can't find how to derive/find the actual metrics.

Can kind souls please point the way?

And/or please let me know if I'm missing anything else of importance to complete my task.

All the best,

LRP

eg_font_7.erl

eg_afm.erl

5 hours ago, LRP said:

Can kind souls please point the way?

You probably want to start with a font converter app to convert the TrueType fonts to PostScript Type1 fonts. Then you need to convert those to the custom Erlang font format.    

  • Author

Thanks Ralf,

Can you or another suggest the most effective converter apps?

Thanks again,

LRP

 

 

  • Author

Hi Ralf,

My dev system is Linux (Ubuntu).

Inspired by your post I did find ttf2ps1.  Last update seems to be 2003. But if it compiles, it may do the job. If you are aware of anything more resent or capable, however, I'm all ears.

ErlGuten, the app I'm modifying and extending, does creditable typesetting of Type 1 fonts. But it's more undocumented concept than polished software. My goal is to polish up the code and extend it into a functional typesetting/page makeup system.

I much appreciate your help and, as a font noobie, need all the help I can get. 

Thanks,

LRP

 

  • Author

Hello,

Perhaps I asked the wrong question in my previous post. So here's a re-take:

My task is to program a copy fitting/justification routine for a program that generates PDF files.

Which PDF font files provide the metrics I need; e.g. character widths, etc?

Many thanks,

LRP

  • Author

I mean TrueType files.

Create an account or sign in to comment

Important Information

We are placing functional cookies on your device to help make this website better.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.