World: r3wp
[PDF-Maker] discuss Gabriele's pdf-maker
older newer | first last |
Graham 23-Aug-2010 [687] | so for i 1 100 10 [ apply transformation i i [ image i i w h load %file.jpg ] ] would work? |
Gabriele 23-Aug-2010 [688x2] | transformation = ? |
translation? | |
Graham 23-Aug-2010 [690] | translation :) |
Gabriele 23-Aug-2010 [691] | if so yes, but maybe you want 0 0 for the image origin? |
Graham 23-Aug-2010 [692] | oh yeah ... |
Gabriele 23-Aug-2010 [693] | the x and y for images are there so that you don't have to use a translation each time :) |
Graham 23-Aug-2010 [694x3] | the other way it moves faster off the page |
I think Nick has enough to start the tutorial :) | |
The question for tomorrow is .. how to get a block of text fully justified with microkerning | |
Gabriele 23-Aug-2010 [697] | simplest form (default values used for everything): textbox [ "This is an example" ] |
Graham 23-Aug-2010 [698] | that does both left and right justification? |
Gabriele 23-Aug-2010 [699x2] | yes, that is the default. |
(you'll need a longer string to see it of course :) | |
Graham 23-Aug-2010 [701] | do you have a hyphenation dictionary? |
Gabriele 23-Aug-2010 [702] | no, you have to handle that. |
Graham 23-Aug-2010 [703] | so does it just wrap on words? |
Gabriele 23-Aug-2010 [704x5] | yes. |
you can define hyphenation points with -- | |
eg.: "This is an ex" -- "am" -- "ple" | |
so if you have a dictionary, you can preprocess your text and just output that. | |
hyphens have a slight penalty so the engine will try to avoid them unless necessary. it also tries to avoid more than one in a row. | |
Graham 23-Aug-2010 [709] | kerning? |
Gabriele 23-Aug-2010 [710x3] | it is automatic. |
you can add manual kerning with the kern command | |
eg. "abc" kern 1 "def" | |
Graham 23-Aug-2010 [713x2] | so if text flow is automatic ... how do you know if the text overlows the box provided? |
or, how does one flow text from one page to the next ? | |
Gabriele 23-Aug-2010 [715] | what you can do is create a stream of text, and then flow it across multiple text boxes, or multiple pages. |
Graham 23-Aug-2010 [716] | eg ? |
Gabriele 23-Aug-2010 [717x4] | for example, see the text that starts at page 4 in the test.pdf file? |
that is defined in the test-pdfm.r file where it says: text book [ .... ] | |
then, the pages are defined as: any [ textbox 10 29 90 248 from book textbox 110 29 90 248 from book ] | |
which means: "create ANY number of pages, as necessary, using the following as the template for each page" | |
Graham 23-Aug-2010 [721] | so that means you must have headers and footers too? |
Gabriele 23-Aug-2010 [722x2] | the template can include anything you wish, images, other text, etc. |
i don't remember if page numbers are implemented or not | |
Graham 23-Aug-2010 [724] | so book is the template? |
Gabriele 23-Aug-2010 [725x3] | book is the text stream. the block with the two textboxes is the template (two columns) |
the text stream is flown inside the columns. | |
so, it gets rendered inside the first textbox, any text that does not fit goes to the second textbox, if there is still more text, a new page is created and so on. | |
Graham 23-Aug-2010 [728] | ok understood |
Gabriele 23-Aug-2010 [729] | you can have different templates for even and odd pages. |
Graham 23-Aug-2010 [730] | drop-image? |
Gabriele 23-Aug-2010 [731] | flowing text around an image? not implemented yet. it's not trivial unless the image is fixed within the text. (this is a limitation of the TeX algorithm, the width of each row of text must be known in advance) |
Graham 23-Aug-2010 [732] | drop-image load %"Gabriele Fototessera small.jpg" |
Gabriele 23-Aug-2010 [733x2] | ah, i think that is a custom function. you can define your own "functions" or "macros" within the dialect. |
define-func 'drop-image [img font size /local iw ih lh mrgns] [ ( iw: img/size/x / 5.34 ih: img/size/y / 5.34 lh: pdfm/get-font-info font size lh: lh/max-height + lh/max-depth mrgns: copy [0 0] loop round/ceiling ih / lh - 1 [ repend mrgns [iw + 2 0] ] append mrgns [0 0] none ) justify with margins mrgns box iw lh 0 [ image xbl ybl - ih + lh iw ih img ] space 2 font* font size ] | |
Graham 23-Aug-2010 [735] | ahh... ok |
Gabriele 23-Aug-2010 [736] | as you see, it determines the image size, then sets the text margins so that you can make it flow around the image. it's a "trick" but it works if the image is not fixed within the page but moves around with the text, and you know it won't be split across pages. |
older newer | first last |