Hello, there is something which still puzzles me in \pdfliteral regarding q..Q rules. Lets take \def\test{\vrule width12bp height12bp depth0pt } To make some graphic-safe stuff in old pdfTeX one could to say \test \pdfliteral{q}% \test \pdfliteral{Q 1 0 0 1 12 0 cm}% \test Starting from pdfTeX 1.30 one can accomplish that using `page' keyword, which results in better content stream \test \pdfliteral page{q}% \test \pdfliteral page{Q}% \test But once we use both (which is not quite useless!) we finish somewhere outside the page; \test \pdfliteral page{q}% some graphic operators \pdfliteral{q}% some transform \test \pdfliteral{Q 1 0 0 1 12 0 cm}% \pdfliteral page{Q}% \test The reason is that last the matrix (translating coordinates back to the lower-left corner) is placed after the _second_ Q. But I'd rather expect that transform after the first (inner) one. What is the reason for that? -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On Tue, May 08, 2007 at 11:09:48AM +0200, Pawe? Jackowski wrote:
\test \pdfliteral page{q}% some graphic operators \pdfliteral{q}% some transform \test \pdfliteral{Q 1 0 0 1 12 0 cm}% \pdfliteral page{Q}% \test
The reason is that last the matrix (translating coordinates back to the lower-left corner) is placed after the _second_ Q. But I'd rather expect that transform after the first (inner) one. What is the reason for that?
Add \pdfcompresslevel=0, then you get a readable page stream in
the PDF file.
The last \pdfliteral section:
1 0 0 1 115.925 622.631 cm
Q 1 0 0 1 12 0 cm
Q
1 0 0 1 -115.925 -622.631 cm
The switched last two lines probably cause your trouble.
I wouldn't use "page" for stuff that affects the transform
matrix. See also the latest pdftex.def.
Yours sincerely
Heiko
1 0 0 1 115.925 622.631 cm Q 1 0 0 1 12 0 cm Q 1 0 0 1 -115.925 -622.631 cm The switched last two lines probably cause your trouble.
Of course it does, that is exactly what I'm talking about.
I wouldn't use "page" for stuff that affects the transform matrix. See also the latest pdftex.def.
This is not the question of my preferences, I'm showing a heavy inconsistence in pdfTeX behaviour. Look: 1\pdfliteral direct{q}2% \pdfliteral{q}3% \pdfliteral{Q}4% \pdfliteral direct{Q}% 5\end This gives exactly what I expect. But now just replace '4' with a space: 1\pdfliteral direct{q}2% \pdfliteral{q}3% \pdfliteral{Q} % \pdfliteral direct{Q}% 5\end and you get something completely different and hopelessly spoiled The reason is that the transformation matrix is not serialized until pdfTeX thinks its necessary. If there is no BT..ET before the second Q, the matrix is restored _after_ that operator, which leads to disaster. But I can't see the reason for that postponed matrix restore... -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On Tue, May 08, 2007 at 01:39:45PM +0200, Pawe?? Jackowski wrote:
1 0 0 1 115.925 622.631 cm Q 1 0 0 1 12 0 cm Q 1 0 0 1 -115.925 -622.631 cm The switched last two lines probably cause your trouble.
Of course it does, that is exactly what I'm talking about.
I wouldn't use "page" for stuff that affects the transform matrix. See also the latest pdftex.def.
This is not the question of my preferences, I'm showing a heavy inconsistence in pdfTeX behaviour. Look:
1\pdfliteral direct{q}2% \pdfliteral{q}3% \pdfliteral{Q}4% \pdfliteral direct{Q}% 5\end
This gives exactly what I expect. But now just replace '4' with a space:
1\pdfliteral direct{q}2% \pdfliteral{q}3% \pdfliteral{Q} % \pdfliteral direct{Q}% 5\end
and you get something completely different and hopelessly spoiled
The reason is that the transformation matrix is not serialized until pdfTeX thinks its necessary.
That's the point. You are saying with "page" or "direct" that
it is not necessary. But "Q" changes the transform matrix. Thus
you should not use "q" and "Q" with keywords "page" or "direct".
Yours sincerely
Heiko
That's the point. You are saying with "page" or "direct" that it is not necessary. But "Q" changes the transform matrix. Thus you should not use "q" and "Q" with keywords "page" or "direct".
? afair `page' keyword has been introduced to fix the problem of not balanced q..Q within ET..BT, so why the user should not use them? We all agree that `direct' is for something different, but `page' keyword suits q..Q pretty well. But both makes problems is used together with no-keyword form. And both wouldn't, if pdfTeX didn't postpone matrix serialization just after \pdfliteral. And still I can't see the reason, since in the case of \pdfliteral this matrix have to be wrote anyway, so why not in a proper place -) -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On Tue, May 08, 2007 at 02:50:38PM +0200, Pawe?? Jackowski wrote:
That's the point. You are saying with "page" or "direct" that it is not necessary. But "Q" changes the transform matrix. Thus you should not use "q" and "Q" with keywords "page" or "direct".
? afair `page' keyword has been introduced to fix the problem of not balanced q..Q within ET..BT,
I don't know the original intensions. IMHO "page" is for operators
that should go outside BT..ET and operators that affect the
transform matrix should use no keyword.
Yours sincerely
Heiko
participants (2)
-
Heiko Oberdiek
-
Paweł Jackowski