eideticpdf 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/fonts/AntiqueOlive-Bold.afm +406 -0
  2. data/fonts/AntiqueOlive-Bold.inf +27 -0
  3. data/fonts/AntiqueOlive-Compact.afm +401 -0
  4. data/fonts/AntiqueOlive-Compact.inf +27 -0
  5. data/fonts/AntiqueOlive-Italic.afm +401 -0
  6. data/fonts/AntiqueOlive-Italic.inf +27 -0
  7. data/fonts/AntiqueOlive-Roman.afm +409 -0
  8. data/fonts/AntiqueOlive-Roman.inf +27 -0
  9. data/fonts/AvantGarde-Book.afm +667 -0
  10. data/fonts/AvantGarde-Book.inf +26 -0
  11. data/fonts/AvantGarde-BookOblique.afm +667 -0
  12. data/fonts/AvantGarde-BookOblique.inf +26 -0
  13. data/fonts/AvantGarde-Demi.afm +673 -0
  14. data/fonts/AvantGarde-Demi.inf +26 -0
  15. data/fonts/AvantGarde-DemiOblique.afm +673 -0
  16. data/fonts/AvantGarde-DemiOblique.inf +26 -0
  17. data/fonts/Bookman-Demi.afm +669 -0
  18. data/fonts/Bookman-Demi.inf +25 -0
  19. data/fonts/Bookman-DemiItalic.afm +669 -0
  20. data/fonts/Bookman-DemiItalic.inf +25 -0
  21. data/fonts/Bookman-Light.afm +643 -0
  22. data/fonts/Bookman-Light.inf +25 -0
  23. data/fonts/Bookman-LightItalic.afm +620 -0
  24. data/fonts/Bookman-LightItalic.inf +25 -0
  25. data/fonts/Clarendon-Bold.afm +412 -0
  26. data/fonts/Clarendon-Bold.inf +27 -0
  27. data/fonts/Clarendon-Light.afm +410 -0
  28. data/fonts/Clarendon-Light.inf +27 -0
  29. data/fonts/Clarendon.afm +410 -0
  30. data/fonts/Clarendon.inf +27 -0
  31. data/fonts/CooperBlack-Italic.afm +421 -0
  32. data/fonts/CooperBlack-Italic.inf +26 -0
  33. data/fonts/CooperBlack.afm +427 -0
  34. data/fonts/CooperBlack.inf +26 -0
  35. data/fonts/Coronet-Regular.afm +327 -0
  36. data/fonts/Coronet-Regular.inf +25 -0
  37. data/fonts/Courier-Bold.afm +342 -0
  38. data/fonts/Courier-Bold.inf +26 -0
  39. data/fonts/Courier-BoldOblique.afm +342 -0
  40. data/fonts/Courier-BoldOblique.inf +26 -0
  41. data/fonts/Courier-Oblique.afm +342 -0
  42. data/fonts/Courier-Oblique.inf +26 -0
  43. data/fonts/Courier.afm +342 -0
  44. data/fonts/Courier.inf +26 -0
  45. data/fonts/Eurostile.afm +419 -0
  46. data/fonts/Eurostile.inf +27 -0
  47. data/fonts/Goudy-ExtraBold.afm +412 -0
  48. data/fonts/Goudy-ExtraBold.inf +27 -0
  49. data/fonts/Helvetica-Bold.afm +2827 -0
  50. data/fonts/Helvetica-Bold.inf +26 -0
  51. data/fonts/Helvetica-BoldOblique.afm +2827 -0
  52. data/fonts/Helvetica-BoldOblique.inf +26 -0
  53. data/fonts/Helvetica-Condensed-Bold.afm +623 -0
  54. data/fonts/Helvetica-Condensed-Bold.inf +25 -0
  55. data/fonts/Helvetica-Condensed-BoldObl.afm +623 -0
  56. data/fonts/Helvetica-Condensed-BoldObl.inf +25 -0
  57. data/fonts/Helvetica-Condensed-Oblique.afm +528 -0
  58. data/fonts/Helvetica-Condensed-Oblique.inf +25 -0
  59. data/fonts/Helvetica-Condensed.afm +528 -0
  60. data/fonts/Helvetica-Condensed.inf +25 -0
  61. data/fonts/Helvetica-Narrow-Bold.afm +1439 -0
  62. data/fonts/Helvetica-Narrow-Bold.inf +26 -0
  63. data/fonts/Helvetica-Narrow-BoldOblique.afm +1439 -0
  64. data/fonts/Helvetica-Narrow-BoldOblique.inf +26 -0
  65. data/fonts/Helvetica-Narrow-Oblique.afm +1556 -0
  66. data/fonts/Helvetica-Narrow-Oblique.inf +26 -0
  67. data/fonts/Helvetica-Narrow.afm +1556 -0
  68. data/fonts/Helvetica-Narrow.inf +26 -0
  69. data/fonts/Helvetica-Oblique.afm +3051 -0
  70. data/fonts/Helvetica-Oblique.inf +26 -0
  71. data/fonts/Helvetica.afm +3051 -0
  72. data/fonts/Helvetica.inf +26 -0
  73. data/fonts/LetterGothic-Bold.afm +443 -0
  74. data/fonts/LetterGothic-Bold.inf +26 -0
  75. data/fonts/LetterGothic-BoldSlanted.afm +443 -0
  76. data/fonts/LetterGothic-BoldSlanted.inf +26 -0
  77. data/fonts/LetterGothic-Slanted.afm +443 -0
  78. data/fonts/LetterGothic-Slanted.inf +26 -0
  79. data/fonts/LetterGothic.afm +443 -0
  80. data/fonts/LetterGothic.inf +26 -0
  81. data/fonts/LubalinGraph-Book.afm +351 -0
  82. data/fonts/LubalinGraph-Book.inf +25 -0
  83. data/fonts/LubalinGraph-BookOblique.afm +351 -0
  84. data/fonts/LubalinGraph-BookOblique.inf +25 -0
  85. data/fonts/LubalinGraph-Demi.afm +351 -0
  86. data/fonts/LubalinGraph-Demi.inf +25 -0
  87. data/fonts/LubalinGraph-DemiOblique.afm +351 -0
  88. data/fonts/LubalinGraph-DemiOblique.inf +25 -0
  89. data/fonts/Marigold.afm +491 -0
  90. data/fonts/Marigold.inf +27 -0
  91. data/fonts/MonaLisa-Recut.afm +663 -0
  92. data/fonts/MonaLisa-Recut.inf +27 -0
  93. data/fonts/NewCenturySchlbk-Bold.afm +886 -0
  94. data/fonts/NewCenturySchlbk-Bold.inf +25 -0
  95. data/fonts/NewCenturySchlbk-BoldItalic.afm +1521 -0
  96. data/fonts/NewCenturySchlbk-BoldItalic.inf +26 -0
  97. data/fonts/NewCenturySchlbk-Italic.afm +1113 -0
  98. data/fonts/NewCenturySchlbk-Italic.inf +26 -0
  99. data/fonts/NewCenturySchlbk-Roman.afm +1067 -0
  100. data/fonts/NewCenturySchlbk-Roman.inf +26 -0
  101. data/fonts/Optima-Bold.afm +515 -0
  102. data/fonts/Optima-Bold.inf +27 -0
  103. data/fonts/Optima-BoldItalic.afm +712 -0
  104. data/fonts/Optima-BoldItalic.inf +26 -0
  105. data/fonts/Optima-Italic.afm +737 -0
  106. data/fonts/Optima-Italic.inf +26 -0
  107. data/fonts/Optima.afm +501 -0
  108. data/fonts/Optima.inf +27 -0
  109. data/fonts/Palatino-Bold.afm +675 -0
  110. data/fonts/Palatino-Bold.inf +26 -0
  111. data/fonts/Palatino-BoldItalic.afm +702 -0
  112. data/fonts/Palatino-BoldItalic.inf +26 -0
  113. data/fonts/Palatino-Italic.afm +700 -0
  114. data/fonts/Palatino-Italic.inf +26 -0
  115. data/fonts/Palatino-Roman.afm +718 -0
  116. data/fonts/Palatino-Roman.inf +26 -0
  117. data/fonts/StempelGaramond-Bold.afm +412 -0
  118. data/fonts/StempelGaramond-Bold.inf +27 -0
  119. data/fonts/StempelGaramond-BoldItalic.afm +413 -0
  120. data/fonts/StempelGaramond-BoldItalic.inf +27 -0
  121. data/fonts/StempelGaramond-Italic.afm +413 -0
  122. data/fonts/StempelGaramond-Italic.inf +27 -0
  123. data/fonts/StempelGaramond-Roman.afm +412 -0
  124. data/fonts/StempelGaramond-Roman.inf +27 -0
  125. data/fonts/Symbol.afm +213 -0
  126. data/fonts/Symbol.inf +27 -0
  127. data/fonts/Times-Bold.afm +2588 -0
  128. data/fonts/Times-Bold.inf +26 -0
  129. data/fonts/Times-BoldItalic.afm +2384 -0
  130. data/fonts/Times-BoldItalic.inf +26 -0
  131. data/fonts/Times-Italic.afm +2667 -0
  132. data/fonts/Times-Italic.inf +26 -0
  133. data/fonts/Times-Roman.afm +2419 -0
  134. data/fonts/Times-Roman.inf +26 -0
  135. data/fonts/Univers-Bold.afm +712 -0
  136. data/fonts/Univers-Bold.inf +27 -0
  137. data/fonts/Univers-BoldOblique.afm +712 -0
  138. data/fonts/Univers-BoldOblique.inf +27 -0
  139. data/fonts/Univers-Condensed.afm +403 -0
  140. data/fonts/Univers-Condensed.inf +27 -0
  141. data/fonts/Univers-CondensedOblique.afm +403 -0
  142. data/fonts/Univers-CondensedOblique.inf +27 -0
  143. data/fonts/Univers-Light.afm +737 -0
  144. data/fonts/Univers-Light.inf +27 -0
  145. data/fonts/Univers-LightOblique.afm +737 -0
  146. data/fonts/Univers-LightOblique.inf +27 -0
  147. data/fonts/Univers-Oblique.afm +656 -0
  148. data/fonts/Univers-Oblique.inf +27 -0
  149. data/fonts/Univers.afm +656 -0
  150. data/fonts/Univers.inf +27 -0
  151. data/fonts/ZapfChancery-MediumItalic.afm +842 -0
  152. data/fonts/ZapfChancery-MediumItalic.inf +26 -0
  153. data/fonts/ZapfDingbats.afm +225 -0
  154. data/fonts/ZapfDingbats.inf +26 -0
  155. data/lib/epdfafm.rb +334 -0
  156. data/lib/epdfdw.rb +710 -0
  157. data/lib/epdfk.rb +3142 -0
  158. data/lib/epdfo.rb +882 -0
  159. data/lib/epdfpw.rb +1749 -0
  160. data/lib/epdfs.rb +101 -0
  161. data/lib/epdfsw.rb +267 -0
  162. data/lib/epdft.rb +145 -0
  163. data/lib/epdftt.rb +458 -0
  164. data/test/pdf_tests.rb +16 -0
  165. data/test/test.rb +816 -0
  166. data/test/test_epdfafm.rb +202 -0
  167. data/test/test_epdfdw.rb +369 -0
  168. data/test/test_epdfk.rb +47 -0
  169. data/test/test_epdfo.rb +762 -0
  170. data/test/test_epdfpw.rb +129 -0
  171. data/test/test_epdfs.rb +54 -0
  172. data/test/test_epdfsw.rb +314 -0
  173. data/test/test_epdft.rb +198 -0
  174. data/test/test_epdftt.rb +34 -0
  175. data/test/test_helpers.rb +18 -0
  176. data/test/testimg.jpg +0 -0
  177. metadata +247 -0
data/lib/epdftt.rb ADDED
@@ -0,0 +1,458 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: ASCII-8BIT
3
+ #
4
+ # Created by Brent Rowland on 2007-08-26.
5
+ # Copyright (c) 2007, Eidetic Software. All rights reserved.
6
+
7
+ require 'epdfk'
8
+
9
+ module EideticPDF
10
+ module PdfTT # :nodoc:
11
+ NUM_FONTS = 12
12
+
13
+ FONT_WIDTHS = [
14
+ [ # 0 Arial
15
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
16
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
17
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
18
+ 0, 0, 278, 278, 355, 556, 556, 889, 667, 191, # 30
19
+ 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, # 40
20
+ 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, # 50
21
+ 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, # 60
22
+ 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, # 70
23
+ 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, # 80
24
+ 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, # 90
25
+ 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, # 100
26
+ 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, # 110
27
+ 500, 500, 500, 334, 260, 334, 584, 750, 556, 750, # 120
28
+ 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, # 130
29
+ 1000, 750, 611, 750, 750, 222, 222, 333, 333, 350, # 140
30
+ 556, 1000, 333, 1000, 500, 333, 944, 750, 500, 667, # 150
31
+ 278, 333, 556, 556, 556, 556, 260, 556, 333, 737, # 160
32
+ 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, # 170
33
+ 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, # 180
34
+ 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, # 190
35
+ 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, # 200
36
+ 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, # 210
37
+ 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, # 220
38
+ 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, # 230
39
+ 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, # 240
40
+ 556, 556, 556, 500, 556, 500], # 250
41
+ [ # 1 Arial,Bold
42
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
43
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
44
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
45
+ 0, 0, 278, 333, 474, 556, 556, 889, 722, 238, # 30
46
+ 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, # 40
47
+ 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, # 50
48
+ 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, # 60
49
+ 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, # 70
50
+ 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, # 80
51
+ 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, # 90
52
+ 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, # 100
53
+ 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, # 110
54
+ 556, 556, 500, 389, 280, 389, 584, 750, 556, 750, # 120
55
+ 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, # 130
56
+ 1000, 750, 611, 750, 750, 278, 278, 500, 500, 350, # 140
57
+ 556, 1000, 333, 1000, 556, 333, 944, 750, 500, 667, # 150
58
+ 278, 333, 556, 556, 556, 556, 280, 556, 333, 737, # 160
59
+ 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, # 170
60
+ 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, # 180
61
+ 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, # 190
62
+ 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, # 200
63
+ 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, # 210
64
+ 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, # 220
65
+ 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, # 230
66
+ 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, # 240
67
+ 611, 611, 611, 556, 611, 556], # 250
68
+ [ # 2 Arial,Italic
69
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
70
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
71
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
72
+ 0, 0, 278, 278, 355, 556, 556, 889, 667, 191, # 30
73
+ 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, # 40
74
+ 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, # 50
75
+ 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, # 60
76
+ 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, # 70
77
+ 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, # 80
78
+ 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, # 90
79
+ 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, # 100
80
+ 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, # 110
81
+ 500, 500, 500, 334, 260, 334, 584, 750, 556, 750, # 120
82
+ 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, # 130
83
+ 1000, 750, 611, 750, 750, 222, 222, 333, 333, 350, # 140
84
+ 556, 1000, 333, 1000, 500, 333, 944, 750, 500, 667, # 150
85
+ 278, 333, 556, 556, 556, 556, 260, 556, 333, 737, # 160
86
+ 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, # 170
87
+ 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, # 180
88
+ 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, # 190
89
+ 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, # 200
90
+ 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, # 210
91
+ 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, # 220
92
+ 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, # 230
93
+ 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, # 240
94
+ 556, 556, 556, 500, 556, 500], # 250
95
+ [ # 3 Arial,BoldItalic
96
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
97
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
98
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
99
+ 0, 0, 278, 333, 474, 556, 556, 889, 722, 238, # 30
100
+ 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, # 40
101
+ 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, # 50
102
+ 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, # 60
103
+ 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, # 70
104
+ 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, # 80
105
+ 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, # 90
106
+ 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, # 100
107
+ 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, # 110
108
+ 556, 556, 500, 389, 280, 389, 584, 750, 556, 750, # 120
109
+ 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, # 130
110
+ 1000, 750, 611, 750, 750, 278, 278, 500, 500, 350, # 140
111
+ 556, 1000, 333, 1000, 556, 333, 944, 750, 500, 667, # 150
112
+ 278, 333, 556, 556, 556, 556, 280, 556, 333, 737, # 160
113
+ 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, # 170
114
+ 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, # 180
115
+ 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, # 190
116
+ 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, # 200
117
+ 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, # 210
118
+ 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, # 220
119
+ 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, # 230
120
+ 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, # 240
121
+ 611, 611, 611, 556, 611, 556], # 250
122
+ [ # 4 TimesNewRoman
123
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
124
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
125
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
126
+ 0, 0, 250, 333, 408, 500, 500, 833, 778, 180, # 30
127
+ 333, 333, 500, 564, 250, 333, 250, 278, 500, 500, # 40
128
+ 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, # 50
129
+ 564, 564, 564, 444, 921, 722, 667, 667, 722, 611, # 60
130
+ 556, 722, 722, 333, 389, 722, 611, 889, 722, 722, # 70
131
+ 556, 722, 667, 556, 611, 722, 722, 944, 722, 722, # 80
132
+ 611, 333, 278, 333, 469, 500, 333, 444, 500, 444, # 90
133
+ 500, 444, 333, 500, 500, 278, 278, 500, 278, 778, # 100
134
+ 500, 500, 500, 500, 333, 389, 278, 500, 500, 722, # 110
135
+ 500, 500, 444, 480, 200, 480, 541, 778, 500, 778, # 120
136
+ 333, 500, 444, 1000, 500, 500, 333, 1000, 556, 333, # 130
137
+ 889, 778, 611, 778, 778, 333, 333, 444, 444, 350, # 140
138
+ 500, 1000, 333, 980, 389, 333, 722, 778, 444, 722, # 150
139
+ 250, 333, 500, 500, 500, 500, 200, 500, 333, 760, # 160
140
+ 276, 500, 564, 333, 760, 500, 400, 549, 300, 300, # 170
141
+ 333, 576, 453, 250, 333, 300, 310, 500, 750, 750, # 180
142
+ 750, 444, 722, 722, 722, 722, 722, 722, 889, 667, # 190
143
+ 611, 611, 611, 611, 333, 333, 333, 333, 722, 722, # 200
144
+ 722, 722, 722, 722, 722, 564, 722, 722, 722, 722, # 210
145
+ 722, 722, 556, 500, 444, 444, 444, 444, 444, 444, # 220
146
+ 667, 444, 444, 444, 444, 444, 278, 278, 278, 278, # 230
147
+ 500, 500, 500, 500, 500, 500, 500, 549, 500, 500, # 240
148
+ 500, 500, 500, 500, 500, 500], # 250
149
+ [ # 5 TimesNewRoman,Bold
150
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
151
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
152
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
153
+ 0, 0, 250, 333, 555, 500, 500, 1000, 833, 278, # 30
154
+ 333, 333, 500, 570, 250, 333, 250, 278, 500, 500, # 40
155
+ 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, # 50
156
+ 570, 570, 570, 500, 930, 722, 667, 722, 722, 667, # 60
157
+ 611, 778, 778, 389, 500, 778, 667, 944, 722, 778, # 70
158
+ 611, 778, 722, 556, 667, 722, 722, 1000, 722, 722, # 80
159
+ 667, 333, 278, 333, 581, 500, 333, 500, 556, 444, # 90
160
+ 556, 444, 333, 500, 556, 278, 333, 556, 278, 833, # 100
161
+ 556, 500, 556, 556, 444, 389, 333, 556, 500, 722, # 110
162
+ 500, 500, 444, 394, 220, 394, 520, 778, 500, 778, # 120
163
+ 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, # 130
164
+ 1000, 778, 667, 778, 778, 333, 333, 500, 500, 350, # 140
165
+ 500, 1000, 333, 1000, 389, 333, 722, 778, 444, 722, # 150
166
+ 250, 333, 500, 500, 500, 500, 220, 500, 333, 747, # 160
167
+ 300, 500, 570, 333, 747, 500, 400, 549, 300, 300, # 170
168
+ 333, 576, 540, 250, 333, 300, 330, 500, 750, 750, # 180
169
+ 750, 500, 722, 722, 722, 722, 722, 722, 1000, 722, # 190
170
+ 667, 667, 667, 667, 389, 389, 389, 389, 722, 722, # 200
171
+ 778, 778, 778, 778, 778, 570, 778, 722, 722, 722, # 210
172
+ 722, 722, 611, 556, 500, 500, 500, 500, 500, 500, # 220
173
+ 722, 444, 444, 444, 444, 444, 278, 278, 278, 278, # 230
174
+ 500, 556, 500, 500, 500, 500, 500, 549, 500, 556, # 240
175
+ 556, 556, 556, 500, 556, 500], # 250
176
+ [ # 6 TimesNewRoman,Italic
177
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
178
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
179
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
180
+ 0, 0, 250, 333, 420, 500, 500, 833, 778, 214, # 30
181
+ 333, 333, 500, 675, 250, 333, 250, 278, 500, 500, # 40
182
+ 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, # 50
183
+ 675, 675, 675, 500, 920, 611, 611, 667, 722, 611, # 60
184
+ 611, 722, 722, 333, 444, 667, 556, 833, 667, 722, # 70
185
+ 611, 722, 611, 500, 556, 722, 611, 833, 611, 556, # 80
186
+ 556, 389, 278, 389, 422, 500, 333, 500, 500, 444, # 90
187
+ 500, 444, 278, 500, 500, 278, 278, 444, 278, 722, # 100
188
+ 500, 500, 500, 500, 389, 389, 278, 500, 444, 667, # 110
189
+ 444, 444, 389, 400, 275, 400, 541, 778, 500, 778, # 120
190
+ 333, 500, 556, 889, 500, 500, 333, 1000, 500, 333, # 130
191
+ 944, 778, 556, 778, 778, 333, 333, 556, 556, 350, # 140
192
+ 500, 889, 333, 980, 389, 333, 667, 778, 389, 556, # 150
193
+ 250, 389, 500, 500, 500, 500, 275, 500, 333, 760, # 160
194
+ 276, 500, 675, 333, 760, 500, 400, 549, 300, 300, # 170
195
+ 333, 576, 523, 250, 333, 300, 310, 500, 750, 750, # 180
196
+ 750, 500, 611, 611, 611, 611, 611, 611, 889, 667, # 190
197
+ 611, 611, 611, 611, 333, 333, 333, 333, 722, 667, # 200
198
+ 722, 722, 722, 722, 722, 675, 722, 722, 722, 722, # 210
199
+ 722, 556, 611, 500, 500, 500, 500, 500, 500, 500, # 220
200
+ 667, 444, 444, 444, 444, 444, 278, 278, 278, 278, # 230
201
+ 500, 500, 500, 500, 500, 500, 500, 549, 500, 500, # 240
202
+ 500, 500, 500, 444, 500, 444], # 250
203
+ [ # 7 Times-BoldItalic
204
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
205
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
206
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
207
+ 0, 0, 250, 389, 555, 500, 500, 833, 778, 278, # 30
208
+ 333, 333, 500, 570, 250, 333, 250, 278, 500, 500, # 40
209
+ 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, # 50
210
+ 570, 570, 570, 500, 832, 667, 667, 667, 722, 667, # 60
211
+ 667, 722, 778, 389, 500, 667, 611, 889, 722, 722, # 70
212
+ 611, 722, 667, 556, 611, 722, 667, 889, 667, 611, # 80
213
+ 611, 333, 278, 333, 570, 500, 333, 500, 500, 444, # 90
214
+ 500, 444, 333, 500, 556, 278, 278, 500, 278, 778, # 100
215
+ 556, 500, 500, 500, 389, 389, 278, 556, 444, 667, # 110
216
+ 500, 444, 389, 348, 220, 348, 570, 778, 500, 778, # 120
217
+ 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, # 130
218
+ 944, 778, 611, 778, 778, 333, 333, 500, 500, 350, # 140
219
+ 500, 1000, 333, 1000, 389, 333, 722, 778, 389, 611, # 150
220
+ 250, 389, 500, 500, 500, 500, 220, 500, 333, 747, # 160
221
+ 266, 500, 606, 333, 747, 500, 400, 549, 300, 300, # 170
222
+ 333, 576, 500, 250, 333, 300, 300, 500, 750, 750, # 180
223
+ 750, 500, 667, 667, 667, 667, 667, 667, 944, 667, # 190
224
+ 667, 667, 667, 667, 389, 389, 389, 389, 722, 722, # 200
225
+ 722, 722, 722, 722, 722, 570, 722, 722, 722, 722, # 210
226
+ 722, 611, 611, 500, 500, 500, 500, 500, 500, 500, # 220
227
+ 722, 444, 444, 444, 444, 444, 278, 278, 278, 278, # 230
228
+ 500, 556, 500, 500, 500, 500, 500, 549, 500, 556, # 240
229
+ 556, 556, 556, 444, 500, 444], # 250
230
+ [ # 8 CourierNew
231
+ 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
232
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
233
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
234
+ 0, 0, 600, 600, 600, 600, 600, 600, 600, 600, # 30
235
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 40
236
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 50
237
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 60
238
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 70
239
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 80
240
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 90
241
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 100
242
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 110
243
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 120
244
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 130
245
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 140
246
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 150
247
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 160
248
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 170
249
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 180
250
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 190
251
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 200
252
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 210
253
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 220
254
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 230
255
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 240
256
+ 600, 600, 600, 600, 600, 600], # 250
257
+ [ # 9 CourierNew,Bold
258
+ 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
259
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
260
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
261
+ 0, 0, 600, 600, 600, 600, 600, 600, 600, 600, # 30
262
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 40
263
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 50
264
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 60
265
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 70
266
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 80
267
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 90
268
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 100
269
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 110
270
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 120
271
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 130
272
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 140
273
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 150
274
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 160
275
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 170
276
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 180
277
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 190
278
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 200
279
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 210
280
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 220
281
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 230
282
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 240
283
+ 600, 600, 600, 600, 600, 600], # 250
284
+ [ # 10 CourierNew,Italic
285
+ 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
286
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
287
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
288
+ 0, 0, 600, 600, 600, 600, 600, 600, 600, 600, # 30
289
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 40
290
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 50
291
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 60
292
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 70
293
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 80
294
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 90
295
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 100
296
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 110
297
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 120
298
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 130
299
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 140
300
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 150
301
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 160
302
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 170
303
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 180
304
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 190
305
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 200
306
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 210
307
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 220
308
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 230
309
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 240
310
+ 600, 600, 600, 600, 600, 600], # 250
311
+ [ # 11 CourierNew,BoldItalic
312
+ 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 0
313
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 10
314
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20
315
+ 0, 0, 600, 600, 600, 600, 600, 600, 600, 600, # 30
316
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 40
317
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 50
318
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 60
319
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 70
320
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 80
321
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 90
322
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 100
323
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 110
324
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 120
325
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 130
326
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 140
327
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 150
328
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 160
329
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 170
330
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 180
331
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 190
332
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 200
333
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 210
334
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 220
335
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 230
336
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, # 240
337
+ 600, 600, 600, 600, 600, 600] # 250
338
+ ]
339
+
340
+ FONT_ASCENDERS = [
341
+ 905, 905, 905, 905,
342
+ 891, 891, 891, 891,
343
+ 833, 833, 833, 833
344
+ ]
345
+
346
+ FONT_DESCENDERS = [
347
+ -212, -212, -212, -212,
348
+ -216, -216, -216, -216,
349
+ -300, -300, -300, -300
350
+ ]
351
+
352
+ FONT_FLAGS = [
353
+ 32, 16416, 96, 16480,
354
+ 34, 16418, 98, 16482,
355
+ 34, 16418, 98, 16482
356
+ ]
357
+
358
+ FONT_BBOXES = [
359
+ [ -250, -212, 1213, 1000 ],
360
+ [ -250, -212, 1158, 1000 ],
361
+ [ -250, -212, 1213, 1000 ],
362
+ [ -250, -212, 1184, 1000 ],
363
+ [ -250, -216, 1158, 1000 ],
364
+ [ -250, -216, 1172, 1000 ],
365
+ [ -250, -216, 1158, 1000 ],
366
+ [ -250, -216, 1171, 1000 ],
367
+ [ -250, -300, 767, 1000 ],
368
+ [ -250, -300, 719, 1000 ],
369
+ [ -250, -300, 739, 1000 ],
370
+ [ -250, -300, 712, 1000 ]
371
+ ]
372
+
373
+ FONT_ITALIC_ANGLES = [
374
+ 0, 0, -11, -11,
375
+ 0, 0, -11, -11,
376
+ 0, 0, -11, -11
377
+ ]
378
+
379
+ FONT_STEM_VS = [
380
+ 80, 153, 80, 153,
381
+ 73, 136, 73, 131,
382
+ 109, 191, 109, 191
383
+ ]
384
+
385
+ FONT_X_HEIGHTS = [
386
+ 453, 453, 453, 453,
387
+ 446, 446, 446, 446,
388
+ 417, 417, 417, 417
389
+ ]
390
+
391
+ FONT_MISSING_WIDTHS = [
392
+ 277, 321, 277, 329,
393
+ 321, 250, 376, 325,
394
+ 639, 599, 616, 593
395
+ ]
396
+
397
+ FONT_STEM_HS = [
398
+ 80, 153, 80, 153,
399
+ 73, 136, 73, 131,
400
+ 109, 191, 109, 191
401
+ ]
402
+
403
+ FONT_LEADINGS = [
404
+ 150, 150, 150, 150,
405
+ 149, 149, 149, 149,
406
+ 133, 133, 133, 133
407
+ ]
408
+
409
+ FONT_MAX_WIDTHS = [
410
+ 1011, 965, 1011, 987,
411
+ 965, 977, 965, 976,
412
+ 639, 599, 616, 593
413
+ ]
414
+
415
+ FONT_AVG_WIDTHS = [
416
+ 441, 479, 441, 479,
417
+ 401, 427, 402, 412,
418
+ 600, 600, 600, 600
419
+ ]
420
+
421
+ FONT_CAP_HEIGHTS = [
422
+ 905, 905, 905, 905,
423
+ 891, 891, 891, 891,
424
+ 833, 833, 833, 833
425
+ ]
426
+
427
+ FONT_NAMES = [
428
+ 'Arial',
429
+ 'Arial,Bold',
430
+ 'Arial,Italic',
431
+ 'Arial,BoldItalic',
432
+ 'TimesNewRoman',
433
+ 'TimesNewRoman,Bold',
434
+ 'TimesNewRoman,Italic',
435
+ 'TimesNewRoman,BoldItalic',
436
+ 'CourierNew',
437
+ 'CourierNew,Bold',
438
+ 'CourierNew,Italic',
439
+ 'CourierNew,BoldItalic'
440
+ ]
441
+
442
+ def font_index(font_name)
443
+ FONT_NAMES.index(font_name)
444
+ end
445
+
446
+ def font_metrics(font_name)
447
+ index = font_index(font_name)
448
+ raise Exception.new("Unknown font #{font_name}.") unless index
449
+ needs_descriptor = index >= 12
450
+ PdfK::FontMetrics.new(needs_descriptor, FONT_WIDTHS[index], FONT_ASCENDERS[index], FONT_DESCENDERS[index], FONT_FLAGS[index], FONT_BBOXES[index],
451
+ FONT_MISSING_WIDTHS[index], FONT_STEM_VS[index], FONT_STEM_HS[index], FONT_ITALIC_ANGLES[index],
452
+ FONT_CAP_HEIGHTS[index], FONT_X_HEIGHTS[index], FONT_LEADINGS[index], FONT_MAX_WIDTHS[index], FONT_AVG_WIDTHS[index],
453
+ PdfK::UNDERLINE_POSITION, PdfK::UNDERLINE_THICKNESS)
454
+ end
455
+
456
+ module_function :font_index, :font_metrics
457
+ end
458
+ end
data/test/pdf_tests.rb ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Brent Rowland on 2007-08-12.
4
+ # Copyright (c) 2007, 2008 Eidetic Software. All rights reserved.
5
+
6
+ $: << File.dirname(__FILE__)
7
+
8
+ require 'test_epdfs'
9
+ require 'test_epdfo'
10
+ require 'test_epdfsw'
11
+ require 'test_epdfk'
12
+ require 'test_epdftt'
13
+ require 'test_epdfafm'
14
+ require 'test_epdft'
15
+ require 'test_epdfpw'
16
+ require 'test_epdfdw'