freetype-devel
[Top][All Lists]
Advanced

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

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


From: Gustavo J. A. M. Carneiro
Subject: RE: [Devel] Metric for hat (^) vertical offset?
Date: Tue, 28 Oct 2003 13:45:20 +0000

A Seg, 2003-10-27 às 18:21, Graham Asher escreveu:
> 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.
> >>>>>>
> 
> Gustavo,
> 
> 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.)

  Well, did I mention I'm rendering MathML?  In MathML, all such fine
details are already considered in the MathML 2.0 reference.  In
particular, the mathml code that produced the image in the last email
was:
<math>
  <mover accent="true">
    <mi>&mu;</mi>
    <mo>&Hat;</mo>
  </mover>
</math>

So, you see, the accent and the base are indeed treated as a single
group.  The reason why layout is failing is that freetype indicates an
excessively large bounding box for the ^ glyph.  There's another image
in attachment show the bounding box of ^ alone, to demonstrate this.

> 
> 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
> version.

  This is also taken care in MathML: the accent is automatically resized
to cover the base (horizontal stretching.) ;-)

  Thanks for your reply though.  Regards.

-- 
Gustavo João Alves Marques Carneiro
<address@hidden> <address@hidden>

PNG image


reply via email to

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