Hi,
when I combine the output of text in a parbox with manual newlines ('//')
and some horizontal alignment other then left-aligned, the output is not
what I would expect. Please have a look at the example below which is based
on one of the examples from the PyX web pages with some additional
newlines:

#########################################################################

#!/usr/bin/env python

from pyx import *

text.set(mode='latex')
text.preamble(r'\setlength{\parindent}{0pt}')

c = canvas.canvas()

c.stroke(path.line(-5, -6, -5, 4))
c.stroke(path.line(0, -6, 0, 4))
c.stroke(path.line(5, -6, 5, 4))

##### WRONG RESULTS #####

c.text(0, 4, r"boxcenter\\and flushleft",
        [text.parbox(3), text.halign.boxcenter, text.halign.flushleft])
c.text(0, 3, r"boxcenter\\and flushcenter",
        [text.parbox(3), text.halign.boxcenter, text.halign.flushcenter])
c.text(0, 2, r"boxcenter\\and flushright",
        [text.parbox(3), text.halign.boxcenter, text.halign.flushright])

c.text(-5, 0, r"left:\\boxleft and flushleft",
        [text.parbox(3), text.halign.left])
c.text(0, 0, r"center:\\boxcenter and flushcenter",
        [text.parbox(3), text.halign.center])
c.text(5, 0, r"right:\\boxright and flushright",
        [text.parbox(3), text.halign.right])

##### EXPECTED RESULTS #####

c.text(0, -2, r"\raggedright boxcenter\\and flushleft",
        [text.parbox(3), text.halign.boxcenter, text.halign.flushleft])
c.text(0, -3, r"\centering boxcenter\\and flushcenter",
        [text.parbox(3), text.halign.boxcenter, text.halign.flushcenter])
c.text(0, -4, r"\raggedleft boxcenter\\and flushright",
        [text.parbox(3), text.halign.boxcenter, text.halign.flushright])

c.text(-5, -6, r"\raggedright left:\\boxleft and flushleft",
        [text.parbox(3), text.halign.left])
c.text(0, -6, r"\centering center:\\boxcenter and flushcenter",
        [text.parbox(3), text.halign.center])
c.text(5, -6, r"\raggedleft right:\\boxright and flushright",
        [text.parbox(3), text.halign.right])

c.writePDFfile("halign")

#########################################################################

Without explicitly specifying the alignment, the output is rather strange.
Or am I missing something and everyting works as expected?

Thanks for any hint,
Tom

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to