[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: Thu, 12 Mar 2009 17:47:01 +0800

On Thu, Mar 12, 2009 at 5:02 PM, Michael Goffioul <address@hidden> wrote:
On Thu, Mar 12, 2009 at 8:53 AM, Ben Abbott <address@hidden> wrote:
> On Mar 11, 2009, at 2:37 PM, xianghang liu wrote:
>> Two functions below are two methods of computing bounding box of a text
>> object. I wrote them following algorithms used in GD and Freetype. Only a
>> slight diiference is between them. It is the computation of bounding box of
>> a charachter. And the final result of them are slightly different as well.
>> Please tell me if you find any mistakes or have suggestions.
> I'm confused by what is meant by "bounding box", and as I'm unfamiliar with
> FreeType (and have poor c++ skills) I'm uncertain that this implementation
> will result in what is expected for the text object property, "extent".
> Consider the three examples below (from Matlab).
>>> h1 = text(0,0,'_','interpreter','none','units','points','fontsize',12);
>>> h2 = text(0,0,'|','interpreter','none','units','points','fontsize',12);
>>> h3 = text(0,0,'-','interpreter','none','units','points','fontsize',12);
>>> get(h1,'extent')
> ans =
>            0         -8.8          8.8           16
>>> get(h2,'extent')
> ans =
>            0         -8.8          5.6           16
>>> get(h3,'extent')
> ans =
>            0         -8.8          6.4           16
> The choice of character only impacts the width of the extent. The lower left
> corner and height of the extent is constant.

I guess y and h (assuming the extent is [x y w h]) are
considered constant for a given font and computed from the
font ascent, descent and height ((0,0) being the baseline).
While the width is string dependent.

Does the extent takes the margin property into account?

I guess some futher transformations, such as translation, rotation and scale transformation might be needed. Because we need to transform it to the coordinate system of the figure.  I used the following script in matlab:
>h = text(pi,0,' {\itAe}^{-\alpha\itt}sin\beta{\itt}\alpha<<\beta','FontSize',18)
>ext = get(h,'extent');
>hold on,rectangle('Position',ext)

I would like to do some experiments of coordinate transformation and try to solve this problem.
Xianghang Liu

reply via email to

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