From: William B H. <wb...@un...> - 2012-01-08 20:23:19
|
On Sun, 8 Jan 2012 14:38:18 -0500 Charles Bowman <bo...@bu...> wrote: > > Here's some: > > -------------------- > from pyx import * > > text.set(mode="latex") > text.preamble(r"\usepackage{ulem}") # underlining >text... > > text.preamble(r"\usepackage{anyfontsize}") # one way of >scaling fonts (except > math fonts).... > > text.preamble(r"\DeclareFixedFont{\LittleFont}{T1}{ptm}{b}{it}{0.75in}") ># > another way of scaling font sizes...(except math >fonts...) > > text.preamble(r"\DeclareFixedFont{\TinyFont}{T1}{ptm}{m}{n}{0.01in}") > > > # For scaling both math and text fonts use: > [trafo.scale(scale factor)] > #~ c.text(5,-5,r'Scaling both Text and Math Fonts: >$\sum$',[trafo.scale(4)]) > > unit.set(defaultunit='cm') > > c = canvas.canvas() > > > c.text(5,5,r'\TinyFont{You Have to Magnify To See This >Font!}') > > c.text(3,4,r'\fontsize{4}{3}\selectfont Adjust font size >on the fly...') > > c.text(5,3,r'{\bfseries{Using non-standard}} font sizes >and underlining text') > > c.text(3,2,r'\Huge{ >$\backslash$fontsize$\{size\}$$\{spacing\}$\selectfont >...}') > c.text(5,0.5,r'\fontsize{30}{25}\selectfont 1$^{st}$ >\uline{parameter} is > \uuline{font} size. 2$^{nd}$ is the \uwave{spacing}') > c.text(3,0,r'\fontsize{6}{4}\selectfont small stuff') > > c.text(5,-2,r'\fontsize{40}{5}\selectfont $\phi, \pi$') > > > c.text(5,-5,r'Scaling both Text \uline{and} Math Fonts: >$\sum_{{n < k}^2}^2 > P(x)$',[trafo.scale(4)]) > c.text(5,-6,r'Scaling both Text and Math Fonts: >$\sum_{{n < k}^2}^2 > P(x)$',[trafo.scale(0.4)]) > > > c.writeEPSfile("minimalText") > c.writePDFfile("minimalText") > > -------------------------------- > > Hello, > > I am using PyX to write text into my output PDF >document. I have looked > at the user manual, as well as the tutorial, and am >having trouble > figuring out how to change things like fonts, or add >underlining to > text. Are there any examples out there that I can use to >get a better > understanding of how to change these text/font >properties?? > > Thanks, Bill > > > > > > > > > > > ------------------------------------------------------------------------------ > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you >don't need a complex > infrastructure or vast IT resources to deliver seamless, >secure access to > virtual desktops. With this all-in-one solution, easily >deploy virtual > desktops for less than the cost of PCs and save 60% on >VDI infrastructure > costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox > _______________________________________________ > PyX-user mailing list > PyX...@li... > https://lists.sourceforge.net/lists/listinfo/pyx-user Thanks for responding Charles, I have tried code similar to yours that I found in the documentation, but I keep getting errors like this: Traceback: File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response 100. response = callback(request, *callback_args, **callback_kwargs) File "/home/wilbur/IOM/iom_catalog/views.py" in hello_kitty 53. text.preamble(r"\DeclareFixedFont{\LittleFont}{T1}{ptm}{b}{it}{0.75in}") File "/usr/lib/pymodules/python2.6/pyx/text.py" in preamble 1169. self.execute(expr, texmessages) File "/usr/lib/pymodules/python2.6/pyx/text.py" in execute 1040. raise TexResultError("unhandled TeX response (might be an error)", self) Exception Type: TexResultError at /test_pyx_pdf/ Exception Value: unhandled TeX response (might be an error) The expression passed to TeX was: \DeclareFixedFont{\LittleFont}{T1}{ptm}{b}{it}{0.75in}% \PyXInput{6}% After parsing the return message from TeX, the following was left: *(/usr/share/texmf-texlive/tex/latex/psnfss/t1ptm.fd) kpathsea: Running mktextfm ptmbi8t mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input ptmbi8t This is METAFONT, Version 2.718281 (TeX Live 2009/Debian) (cut after 5 lines, increase errordebug for more output) |