Re: pango and gtkmathview



Hi.

On Thu, 2003-02-20 at 22:20, Owen Taylor wrote:
> I'm not really sure how math would fit into the Pango framework.

I appreciate you answer. Perhaps I wasn't clear enough in my first
email, I'll try to do a better job here.

Of course math in general doesn't fit the Pango framework. I would never
expect Pango to be able to render a fraction or a letter with an
attached subscript. But math is ultimately made of symbols (both single
chars and also strings). In the particular case of MathML, Unicode chars
and strings. So the idea would be to let Pango format and render those
strings of characters, the ultimate position of which would still be
complete responsibility of gtkmathview.

>  - Fonts. You could possibly use Pango's font listing mechanisms.
> 
>    But you'd have to drop down to accessing the FreeType fonts
>    directly to get things like italic corrections. So, you
>    wouldn't be independent of backend.,

you're right. But the architecture I've designed for gtkmathview allows
me to exploit special capabilities (say italic corrections) when they
are available, or falling back into some default behavior when they are
not. I don't expect to have really precise math typesetting with fonts
that have little to do with math. But if the environment provides me
nice math fonts, I can "down cast" to them and exploit the information
they provide. This too would be gtkmathview's job, provided it is
possible to "down cast" somehow Pango fonts.

>  - Rendering. PangoGlyphString holds a set of positioned glyphs.
>    But it doesn't have capabilities like stretching glyphs.

OK. But as pointed out in the Pango documentation, there is not
necessarily a one-to-one correspondence between Unicode characters and
glyphs. So it may happen _already_now_ that to render a single Unicode
character you actually need to combine two or more glyphs, right? Well,
stretchable characters are just a little extention to this. The main
difference would be that to stretch a character you need to know how
much it should stretch. I understood from Pango API that you can extend
the set of available text attributes. The idea would be to register an
extension attribute, say "vertical-stretch", whose value would be the
height+depth the character should span to. Then the shaper (or whatever
Pango module is responsible for that), would just have to search and
combine the appropriate glyphs, and accordingly provide a bounding box
of the rendered character.

> I'd suspect you'll be better off going directly to Xft and
> fontconfig.

although I have used different things other than Xft and fontconfig,
I've already gone through the painful task of implementing a flexible
architecture for font selection and formatting of characters and the
result is... ehm... really unsatisfactory. For what I can see, there is
a large overlapping of my needs and what Pango provides (Unicode
rendering, which is a _huge_ task). It seems also to me like the missing
things (stretchying and extended metrics) can be accommodated without
modifying the current Pango architecture, at the price of one (or
possibly a few) specialized modules which wouldn't hurt anybody who is
not interested in math.

I hope this lengthy email clarifies the points and that it makes now
some more sense to you.

Best regards,
-- luca






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