[Top][All Lists]

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

Re: about contibuting to octave

From: xianghang liu
Subject: Re: about contibuting to octave
Date: Mon, 23 Mar 2009 16:29:53 +0800

On Sat, Mar 14, 2009 at 5:11 PM, Michael Goffioul <address@hidden> wrote:
On Fri, Mar 13, 2009 at 11:27 AM, xianghang liu <address@hidden> wrote:
> Since I am not familiar with freetype, I have no ideas about how it deals
> with subscripts and superscripts. Please give me some suggestions if you
> know that.
> Thanks.

As Shai said, that's the job of the text processors. Consider the string a_{11}
(a subscript 11). A parser split this string into a datastructure containing a
recursive container pattern; this structure will probably contain 2
top elements:
a text element and a subscripted element. For each of those elements, you can
compute a BB, [x1 y2 w1 h1] and [x2 y2 w2 h2]. Let's consider that you text
processor will offset the subscript by p pixels (in practice, this should be
computed from the font metrics of the subscripted element; for instance half
of the font ascent). The BB of the complete text can be computed as:

[x1 min(y1,y2-p) w1+w2 max(h1,h2+p)]

So is it right to say that position of string elements are decided by the text processors? For example, in "{a}{bc}" the horizontal distance between "a" and "bc", and in "a_{0}" the veritcal offset of element '{0}'.
I think the calculation of bounding box and the rendering of a TeX string is almost the same. And the only difference may be: for each string element render function of backend is called instead of function of bbox calculation. So I think a template method pattern may be used here.
And I am not clear about the mapping from the "fontsize" property of TeX string to the char size of FreeType, and the method to retrive the file name when font name and style (such as Italic or Bold) is given. I think they might be already contained in current octave codes.  If so please tell me where they are contained.

Thank you very much.


reply via email to

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