[Haskell-cafe] Re: bug in HPDF?
roma at ro-che.info
Tue Jan 6 13:51:12 EST 2009
Thanks for helping!
* alpheccar <misc at alpheccar.org> [2009-01-06 19:47:21+0100]
> Here is the source code to do what you want:
> import Graphics.PDF
> import Complex
> main = runPdf "bug.pdf" standardDocInfo (PDFRect 0 0 100 100) pdf
> pdf = do
> p <- addPage Nothing
> drawWithPage p $ do
> moveto $ 10 :+ 10
> sequence $ replicate 10 $ drawText $ text (PDFFont Helvetica
> 10) 0 0 (toPDFString "ABC")
> It is the Text monad that needs to be replicated. Each copy will start
> drawing the text lines at (10,10) as specified by the moveto.
> But, inside the text monad, each "text" will create a new line.
>> Here is a program which illustrates an unexpected behaviour:
>> import Graphics.PDF
>> main = runPdf "bug.pdf" standardDocInfo (PDFRect 0 0 100 100) pdf
>> pdf = do
>> p <- addPage Nothing
>> drawWithPage p $ drawText $
>> sequence $ replicate 10 $
>> text (PDFFont Helvetica 10) 10 10 (toPDFString "ABC")
>> What I expect here is "ABC" printed 10 times on the same place
>> at (10,10)). What I see (in Okular) is ABC printed each time in the new
>> place like this:
>> What's happening here? I'm using HPDF-1.4.1 from Hackage.
>> Roman I. Cheplyaka :: http://ro-che.info/
>> "Don't let school get in the way of your education." - Mark Twain
Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain
More information about the Haskell-Cafe