octave-maintainers
[Top][All Lists]
Advanced

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

Re: Graphics: Title and label properties


From: Michael Goffioul
Subject: Re: Graphics: Title and label properties
Date: Mon, 21 Jul 2008 11:39:11 +0200

On Mon, Jul 21, 2008 at 10:07 AM, Maciek Gajewski
<address@hidden> wrote:
> Yes, taking 3D into account makes problem waaaay more complicated. So maybe
> I'll start with auto-positioning for 2D, and then expand it to 3D.

I would have done the opposite and consider 2D as a special case,
so you have a complete view of the problem from the beginning.
But I guess it's a matter of taste.

>> AFAIK Shai is working on the text engine, including an interface to
>> get font metrics. This should help in placing the labels correctly. But
>> definitely, this auto-location should be taken out of the OpenGL
>> renderer. So, again, help is always welcome.
>
> I've noticed double base_graphics_backend::get_screen_resolution (), which
> could be used for simplest font metrics implementation.
>
> To get complete font metrics information from backend, interface could be
> extended by calls like these:
>
> rectangle get_text_extend ( string text, double font_size, string face_name );
>
> or
>
> rectangle get_text_extend ( handle h, string text ); - where font size and
> face name are taken from properties of object identified by 'h'.

Well, I think it's a little bit more complicated than that. For instance,
TeX-like formatting (like subscripts or superscripts) will have an influence
on the text extent. We had some discussions with Shai about how
to tackle all of this and we end up with the following design ideas
(this is largely inspired by what I did in JHandles):
- separate font rendering, font metrics and text representation
(with TeX formatting info...)
- use a recursive container pattern to represent text content
(Shai already came with a set of classes, maybe you could post
it on the mailing list)
- use a visitor pattern to process the text and perform various
operations; among possible operations are: computing bounding
box, rendering...

Based on that, computing the text extent means parsing the text
representation tree with a fontmetrics provider (here we thought
naturally about using FreeType library).

> Here I have a question: are there any readily-available types in octave which
> can be used to store rectangle, point and other geometrical types?

No. When I need a rectangle or point, I use a Matrix object. This
is usually enough for my purpose.

>> I'd say "better" here is subjective.
>
> I'm not asking because aesthetics. It's because of title location. Axes title
> fits into margin above axes. When default font is too big, margin also needs
> to be big enough.

Basically, the axes position should be computed taking into account
the fontmetrics information for the title, the labels and the tick text.
This is of course missing, because we still need to get fontmetrics
information. For the time being, the margins around an axes are
just static.

Michael.


reply via email to

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