0

I have same code

q
0 0 283.465 170.079 re
W n
BT
1 0 0 0 k
/GS0 gs
/C2_0 1 Tf
10 0 0 10 143.4331 134.0855 Tm
<01F60218020B020802150210020F0208021E02100227>Tj
ET 
Q

How to calculate the fontSize for /C2_0 1 Tf ?

I need example if posible. My english is not good then sorry if questions is wrong.

1

2 Answers 2

1

1.

/C2_0 1 Tf

This command sets the font to 1 pt.

2.

10 0 0 10 143.4331 134.0855 Tm

This command scales the current transformation matrix by a factor of 10 in the x direction, 10 in the y direction and translates/moves the origin to x = 141,4331, y = 132.0855. So basically your font is scaled to 10 pt drawn at (141,4331,132.0855).

Here is an example from http://www.mactech.com/articles/mactech/Vol.15/15.09/PDFIntro/index.html near the bottom of the page.

3 0 obj
<<
/Length 168
>>
stream
BT
/F4 1 Tf
12 0 0 12 50.64 731.52 Tm
0 0 0 rg
BX /GS2 gs EX
0 Tc
0 Tw
[(This is 12-point )10(T)41(imes. )
    18(This sentence will appear near 
    the top of page one.)]TJ
ET
endstream
endobj

"The stream object (which is 168 bytes long) is bracketed by BT and ET operators, for Begin Text and End Text. The Tf command selects our font and its size in user-space units, which is given as 1. "But aren't we using 12-point type?" you may be wondering. Yes, we are. That's specified in the next line, ending in Tm (which is the set-text-matrix operator). For space reasons, we won't say much about coordinate system transformations and matrices here, but if you're familiar with the use of matrices in PostScript, the same rules apply in PDF. A transform matrix is given by an array of six numbers, the first and fourth of which determine scaling in x and y, respectively. We see in our text matrix, the scaling factor is 12. That means we will use 12-point type. The last two numbers in the matrix (50.64 and 731.52) specify a translation, in user-space units. The effect of the translation is to put our text approximately 10.1 inches high on the page, with a left margin of 0.7 inch."

4
  • Yes, I was thinking about this option. But I am confused by the fact that all the calculations we perform in the user space. The documentation says that he still had to convert all the computed values ​​in device space using the matrix cm Even the documentation for all the examples of raw postscript. We describe only the coordinate transformation formula from user space to device space
    – org
    Feb 20, 2012 at 8:16
  • Is it true I think? : We do not need to convert of font size from user space to device space. Because we use values the font size in points (pt). Total: the formula is: scaled matrx [Sx 0 0 Sy 0 0] = [1 0 0 1 0 0] * Tm [abcdef] realFontSize = fontSizeScaledFactor * Scaledy
    – org
    Feb 20, 2012 at 8:21
  • But What can I do to calculate the values of font size ​​in device space?
    – org
    Feb 20, 2012 at 8:23
  • The set text matrix command (Tm) is scaling your font by a factor of 12 both directions. So yo calculate the font height you need to use your equation of 'scaled matrx [Sx 0 0 Sy 0 0] = [1 0 0 1 0 0] * Tm [abcdef] realFontSize = fontSizeScaledFactor * Scaledy' - There is no other way. You can find more information here - partners.adobe.com/public/developer/en/pdf/PDFReference.pdf Feb 22, 2012 at 2:21
0

is that what you mean?

font - /F1 12 Tf: apply the Tf operator, which sets the font name and font size. The font is F1 as defined in the resources, with size 12.

Introduction to PDF

6
  • This is real example from my pdf document: /C2_0 1 Tf. FontSize=1??
    – org
    Feb 17, 2012 at 14:21
  • Yes, this number is for the FontSize. Try to increase it, the Font will be bigger
    – yen1k
    Feb 17, 2012 at 14:27
  • I want to find real fontSize for device space
    – org
    Feb 17, 2012 at 14:31
  • Everything is OK. I'm looking for the answer to this question is already the second week.
    – org
    Feb 17, 2012 at 14:46
  • Have you read this discussion? stackoverflow.com/questions/4509613/…
    – yen1k
    Feb 17, 2012 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.