문제

I'm trying to highlight some text with a glyph width of 1000 (which corresponds to 1 unit of text space)and font size of 1; the transformation matrix is [50 0 0 50 0 0]. The result is text that is too big. But this is not the case. The text that is being displayed is not big at all; it's a normal size.

Any PDF reader I open the file with has no problems highlighting the word, which means that I'm missing something somewhere.

Currently I'm checking for the default font and the font array in the fonts dictionary, the font size, and the transformation matrix. Is there any other way to scale text in a PDF besides the ones I just mentioned?

도움이 되었습니까?

해결책

This answer combines the comments to the original question:

Currently I'm checking for the default font and the font array in the fonts dictionary, the font size, and the transformation matrix. Is there any other way to scale text in a PDF besides the ones I just mentioned?

A few possibility coming to my mind immediately:

  • A new transformation matrix (argument to cm) does not replace the old one; instead it is multiplied to it (from the left).

  • In case of q ... Q you have to consider resets of the current transformation matrix.

    (The current transformation matrix, line widths, colors, overprint settings, and much, much more are part of the graphics state. To get an impression, have a look at the entries in tables 57 and 58 of the PDF specification ISO 32000-1. At least all the properties described there are part of the graphics state and, therefore, saved during q and restored during Q.)

  • Furthermore there is the text matrix to consider.

  • Finally the UserUnit entry of the page might change the rules.

So there's more to look at than the text positioning operators.

For a good overview have a look at section 9.4.4 Text Space Details of the PDF specification, especially Note 2 therein. (Thanks to @plinth.)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top