Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Basic typesetting
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-10-28 (21:38)
From: michael.le_barbier@l...
Subject: Re: [Caml-list] Basic typesetting
Matthieu Dubuget <> writes:
> I will certainly have to parse AFM files in order to find font metrics
> and use them in order to compute the dimensions I need, then...

If you try to compute a ``text object size'' from font metrics the
naive way, you will get a coarse approximation of the true

By computing sizes the naive way, you will not take ``kerning pairs''
neither ``ligatures'' in account.

When typesetting `WA' `TA', etc. it is customary to move the `A' on
the left. You can see this if you use your preferred typesetting tool
(I mean TeX) to process two paragraphs, the first one consisting of
`WA' the second one consisting `EA'. Depending on the font setup, you
can observe that the first `A' starts ``before'' the second. The pairs
`WA' etc. are called kerning pairs.

When typesetting ``terrific'' the `fi' pair is usually replaced by a
single symbol, this symbol is a (decorative) ligature.

So if you use a typesetting engine as a backend to typeset text, you
have three ways to know the size of an object:
  1. ask the engine;
  2. examine the engine's output;
  3. reimplement the engine's algorithms.
You do not seriously consider 3. as an option, do you?
Gute Nacht
Michaël LB