[pdftex] Finding where a Type 3 font is used

James Cloos cloos at jhcloos.com
Sat Oct 8 22:24:50 CEST 2005


I just tried this on a pdf that has a type3 font (according to
pdffonts):

First I ran it through pdftk to uncompress the streams:

:; pdftk original.pdf output uncompressed.pdf uncompress

Then tr(1) the returns to newlines to facilitate viewing it:

:; tr \\r \\n <uncompressed.pdf >viewable.pdf

Then I looked at it in less(1).  A text editor would also work,
especially vim or emacs....

In it, I searched for Type3 and found this object:

,----
| 3761 0 obj
| <</FontMatrix [0.01 0 0 0.01 0 0]
| /FirstChar 0
| /Resources 3762 0 R
| /Name /T1
| /Encoding 3763 0 R
| /CharProcs 3765 0 R
| /Subtype /Type3
| /LastChar 0
| /FontBBox [-55 -55 55 55]
| /Widths [100]
| /Type /Font
| >>
| endobj
`----

So object 3761 is the Type3 font, and 3762, 3763 and 3765 are parts of
it.  It also shows that the font is named T1.  So I looked for each of
those referenced objects and found:

,---- (the font's Resources dict)
| 3762 0 obj
| <</ProcSet [/PDF]
| >>
| endobj
`----

which wasn't very interesting

,---- (the font's Encoding dict)
| 3763 0 obj
| <</Differences [0 /Bullet]
| /Type /Encoding
| >>
| endobj
`----

which shows that it has a single glyph, and that glyph is named
Bullet.

,---- (the font's CharProcs dict)
| 3765 0 obj
| <</Bullet 3764 0 R
| >>
| endobj
`----

which confirms the single glyph and shows that object 3764 has the
code for Bullet.  So,

,---- (the code for the Bullet glyph)
| 3764 0 obj
| <</Length 236
| >>
| stream
| 100 0 -55 -55 55 55 d1
| 1 i
| 49.385 0.000004 m
| 49.385 27.26 27.26 49.385 -0.000004 49.385 c
| -27.26 49.385 -49.385 27.26 -49.385 0.000004 c
| -49.385 -27.26 -27.26 -49.385 -0.000004 -49.385 c
| 27.26 -49.385 49.385 -27.26 49.385 0.000004 c
| f
| 
| endstream
| endobj
`----

As a quick check of above, I ran this (interactively) in ghsotscript:
(s/m/moveto/, s/c/curveto/, s/f/fill/)

,---- (pure ps based on the above stream)
| 100 100 translate                   % to make sure it is visable
| 49.385 0.000004 moveto
| 49.385 27.26 27.26 49.385 -0.000004 49.385 curveto
| -27.26 49.385 -49.385 27.26 -49.385 0.000004 curveto
| -49.385 -27.26 -27.26 -49.385 -0.000004 -49.385 curveto
| 27.26 -49.385 49.385 -27.26 49.385 0.000004 curveto
| fill
`----

and got a nice circle.

Let's us know that it is not a bitmap, as dvips, et al generate from
pk fonts, but rather a glyph that could have been made into a Type1
font....

,----
| 377 0 obj
| <</Rotate 0
| /pdftk_PageNum 223
| /CropBox [0 0 595 842]
| /MediaBox [0 0 595 842]
| /Resources 3766 0 R
| /Parent 3739 0 R
| /Contents 3767 0 R
| /Annots [3768 0 R 3769 0 R 3770 0 R 3771 0 R 3772 0 R 3773 0 R 3774 0 R]
| /Type /Page
| >>
| endobj
`----

Next I went looking for objects that reference the font, ie that ref
object 3761 or the name T1.  I found:

,---- 
| 3755 0 obj
| <</ExtGState <</GS1 6 0 R
| >>
| /Font <</F12 1501 0 R
| /F11 1456 0 R
| /F1 14 0 R
| /F10 1457 0 R
| /F9 1458 0 R
| /T1 3761 0 R
| /F6 97 0 R
| /F5 22 0 R
| >>
| /ProcSet [/PDF /Text]
| >>
| endobj
`----

,----
| 3756 0 obj
| <</Length 19843
| >>
| stream
| 0 0 0 0 k
| . . . e l i d e d . . .
| BT
| /T1 1 Tf
| 4.9813 0 0 4.9813 270.66 736.02 Tm
| . . . e l i d e d . . .
| endstream
| endobj
`----

That one shows that object 3756 actually uses the font.

So we need to know what page includes 3756.  Seaching for 3756 I
found:

,----
| 3754 0 obj
| <</Rotate 0
| /pdftk_PageNum 222
| /CropBox [0 0 595 842]
| /MediaBox [0 0 595 842]
| /Resources 3755 0 R
| /Parent 3739 0 R
| /Contents 3756 0 R
| /Annots [3757 0 R 3758 0 R 3759 0 R 3760 0 R]
| /Type /Page
| >>
| endobj
`----

So I can see that page 222 (helpfully noted by pdftk when it
uncompressed the original pdf) has the Bullet in question.

Looking at that page in xpdf, I'm not sure where the Bullet is, but
can confirm that what xpdf reports as page 222 matches the contents
of object 3756, so it is there somewhere....  The page does have a
bullet in its header line, but every other even page does as well,
so it is unlikely this bullet is there.  There is a line graphic
on the page; the bullet may be part of that; if so perhaps pstricks
generated to glyph.


It isn't automated, but that should give a good recipe for finding
the type3 font in your pdf.

-JimC
-- 
James H. Cloos, Jr. <cloos at jhcloos.com>



More information about the pdftex mailing list