>>>>> "Edin" == Edin Salkovi§ <[EMAIL PROTECTED]> writes:

    Edin> Hi all, Please John, take some time before SciPy conf to
    Edin> answer at least some of this questions, because the SoC
    Edin> deadline (21st August) is *very* near.

Alas, I am already here and have been a little out of email contact
while traveling.  Sorry for the delay.

    Edin> 1) I'm having some problems regarding FT2Font.  The problem
    Edin> is when I instantiate FT2Font like: font = FT2Font(filename)
    Edin> and when I call it's method font.set_text("Some text"), and
    Edin> afterwards, font.draw_glyphs_to_bitmap(), the latter simply
    Edin> deletes every glyph that was drawn before it, and just
    Edin> paints in the internal image buffer the text that was passed
    Edin> on last invocation of set_text (or load_char).

This is a feature, not a bug :-)  You can clear the image buffer if
you want with the clear method, as we do in the mathtexy code

        for fontface in self.fonts.values():
            fontface.clear()

    Edin> This is a pain, because draw_glyphs_to_bitmap implements the
    Edin> layout (with kerning etc.), but if one wants to paint
    Edin> several words in different x,y positions in the same image
    Edin> buffer, he has to do the layout for every character in every
    Edin> word manually via draw_glyph_to_bitmap(x, y, glyph) (like
    Edin> you did with the BaKoMa fonts in mathtext).

    Edin> Why hasn't draw_glyphs_to_bitmap been implemented so that it
    Edin> takes x, y as arguments (draw_glyphs_to_bitmap(x, y)) and
    Edin> leaves the image buffer intact (as does
    Edin> draw_glyph_to_bitmap)?

You can add optional x and y args to draw_glyphs_to_bitmap if you need
them.  Just make sure any changes you make pass
examples/backend_driver.py and unit/memleak_hawaii3.py

    Edin> 2) As I have said before, I have started the complete
    Edin> rewrite of mathtext (the parsing stuff etc.). I have
    Edin> completely removed the dependency on pyparsing (please don't
    Edin> yell at me :), and I was wondering about how much of TeX

OK, I won't yell.  Quietly scold maybe :-)

I am skeptical of your -- or anyone's except Robert's -- ability to
parse TeX mathematical expressions w/o a true recursive descent
parser.  I took a look at your code but w/o any running examples I
could not test it.  From reading it, I do not think it will be able to
handle the deeply recursive structures that are currently supported by
the existing, working parser.  Can you handle recursively nested
super/sub scripts?  Can it parse this

  tex = r'$\cal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\rm{sin}(2 \pi f x_i)$'


If so, I apologize for my skepticism, but my working assumption is you
will need a proper parser to parse tex and string methods aren't going
to get you there.  What I really need to see before even considering a
system that replaces the working system is an argument about why it
needs to be replaced, and more importantly, code that can do
everything the old code can do, such as render the mathtext_demo.py
example?  

    Edin> should mathtext support. I'm not talking about support for
    Edin> \frac, \above, \choose (which I plan to add one by one)
    Edin> etc., but about more general things - macros (\def etc.). I

\above, \frac and \sqrt yes, \def no.  Others I'm not sure about.  

    Edin> was thinking of just simulating them, at least to a
    Edin> tolerable extent, via notion of an enviroment.  Example: \rm
    Edin> in plain TeX sets the current font to roman (until the end
    Edin> of the current scope - 'till it hits "}").  Implementation:
    Edin> At render time, when the parser hits "\rm", it does the
    Edin> folowing: env["facetype"] = "rm", where env is the
    Edin> environment in the current scope.

Can we use classes here rather than dictionaries?  Syntactically, I
prefer env.facetype = "rm" to the dictionary syntax.

    Edin> Also, I am planing to create a separate class for every new
    Edin> layout item that gets implemented.  Example:
    Edin> sub/superscripted item (nucleus_sub^sup) gets translated to
    Edin> an instance of class Scripted that has the attributes
    Edin> nucleus, superscript and subscript.

    Edin> 3) I was thinking of focusing on just the Agg backend for
    Edin> now (that is till' the deadline). Is this OK?  4) I think
    Edin> that we should move the job of math_parse_s_ft2font,
    Edin> math_parse_s_ft2font_svg, and math_parse_s_ps etc.  to the
    Edin> corresponding backends, and that some general function like:
    Edin> math_parse_s(x, y, s, prop, angle) should be implemented
    Edin> directly in mathtext.py (perhaps even without the "angle"
    Edin> parameter) so that it returns a list of the following type:
    Edin> [(x1, y1, s1, prop1, angle1), ... , (xn, yn, sn, propn,
    Edin> anglen)]

I can't address these questions until I understand why you are trying
to rewrite, rather than extend or fix, the existing code.  The agg and
the postscript backends work with the existing frameowork.  As far as
I can see, you could fix the layout engine in the existing framework
and not have to think too much about backends, with the exception that
you need a basic backend line drawing API for things like the
horizontal line in \frac.

    Edin> 5) What would be the consequences of distributing a GPL font
    Edin> (FreeFont) with matplotlib. I mean, it's not that using a
    Edin> GPL font in some non-GPL app could be a breach of the
    Edin> GPL. Is there any interest in this?

Don't underestimate the zealousness of GPL advocates.  I have been
informed by the FSF that merely providing a backend that does 

import qt

in a backend that is optionally included at runtime by a user who may
be using a GPL version of QT or may be using a commercially licensed
version of qt (we can't know which) makes the entire code base of mpl
GPL'd.  This claim was provided w/o argument and I frankly find it
ludicrous.  Robert can probably tell you the IANAL response to
including GPL'd fonts but I'm not too interested in distributing them.
We can always point the user to a web site and they can download them
from.

    Edin> The new mathtext.py is attached. Please do not try it at
    Edin> home ;) because nothing visible yet works.

OK.

JDH

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to