[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Devel] Metric for hat (^) vertical offset?

From: Graham Asher
Subject: RE: [Devel] Metric for hat (^) vertical offset?
Date: Mon, 27 Oct 2003 18:21:02 -0000

Gustavo João Alves Marques Carneiro said (27th Oct. 2003):

I'm trying to do mathml rendering of a circumflex accent (^) on top of
an identifier.  However, the glyph as rendered by freetype2 is
vertically offset, leaving an empty space, like the screenshot in
attachment.  The same problem happens for other glyphs.

  Is there any metric in the font or glyph that can indicate that amount
of empty space?  Because in MathML I need tight bounding box.

  Thanks in advance.  Regards.


You have to treat the base and accent or accents as a group, and not rely on
the horizontal or vertical bearings of the accent glyphs; these are designed
for positioning accents only over a particular class of characters, like
capital letters.

I had to solve a similar problem a while ago and I came to the conclusion
that you have to decide the distance (in font-related units, i.e., ems) you
need between the base and accent and adjust the position of the accent
accordingly. You might look up the rules Donald Knuth's TeX uses for the
placement of what he calls 'math accents'. I have always found him to be a
good guide in the past; he took the best practices of traditional
typesetting and translated them to computing. (I'm afraid I haven't time to
research this for you, but it shouldn't be hard to find.)

One other point: you may want the accent to affect the vertical bounds of
the combined glyph but not the width. That is because it is often desirable
for an accented narrow letter like i to be the same width as the unaccented

Graham Asher

reply via email to

[Prev in Thread] Current Thread [Next in Thread]