summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorkramm <kramm@thorn.(none)>2009-08-18 17:23:00 +0200
committerkramm <kramm@thorn.(none)>2009-08-18 17:23:00 +0200
commit0e9d27093c3e6e8e316fbc08bb9d422d74da2fd1 (patch)
tree54584dcfbb24de0f53573554ef0095b71b8a7a87 /spec
parentecd7c7248b9a93163090bfe7512b2a53d8da6d95 (diff)
implemented type3 fonts in pdf2pdf, added fontmatrix tests to testsuite
Diffstat (limited to 'spec')
-rw-r--r--spec/textposition.pdf146
-rw-r--r--spec/textposition.py54
2 files changed, 200 insertions, 0 deletions
diff --git a/spec/textposition.pdf b/spec/textposition.pdf
new file mode 100644
index 00000000..44743b72
--- /dev/null
+++ b/spec/textposition.pdf
@@ -0,0 +1,146 @@
+%PDF-1.6
+%
+1 0 obj
+[/PDF/ImageB/ImageC/ImageI/Text]
+endobj
+4 0 obj
+<</Length 5 0 R
+/Filter/FlateDecode
+>>
+stream
+xT )z 6g<,@3,?RW-RTdD
+;Rb!",Z{?u6<!Ce}fPMÝSɛVOjj%hcm)eJɏgW#aV[Z!+gjz3wybLhNS)DѡMHQ7Fē& 2G\"$
+endstream
+endobj
+5 0 obj
+213
+endobj
+7 0 obj
+<</ProcSet 1 0 R
+/Font<</F0 6 0 R
+>>
+>>
+endobj
+8 0 obj
+<</CreationDate (D:20090818171028+02'00')
+/Producer (PDFlib Lite 7.0.2p8 \(Python 2.6.2/Linux\))
+>>
+endobj
+6 0 obj
+<</Type/Font
+/Subtype/Type1
+/BaseFont/Helvetica-Bold
+/FontDescriptor 9 0 R
+/FirstChar 0
+/LastChar 255
+/Widths[278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278
+278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278
+278 333 474 556 556 889 722 238 333 333 389 584 278 333 278 278
+556 556 556 556 556 556 556 556 556 556 333 333 584 584 584 611
+975 722 722 722 722 667 611 778 722 278 556 722 611 833 722 778
+667 778 722 667 611 722 667 944 667 667 611 333 278 333 584 556
+333 556 611 556 611 556 333 611 611 278 278 556 278 889 611 611
+611 611 389 556 333 611 556 778 556 556 500 389 280 389 584 278
+278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278
+278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278
+278 333 556 556 556 556 280 556 333 737 370 556 584 333 737 552
+400 549 333 333 333 576 556 278 333 333 365 556 834 834 834 611
+722 722 722 722 722 722 1000 722 667 667 667 667 278 278 278 278
+722 722 778 778 778 778 778 584 778 722 722 722 722 667 667 611
+556 556 556 556 556 556 889 556 556 556 556 556 278 278 278 278
+611 611 611 611 611 611 611 549 611 611 611 611 611 556 611 556]
+/Encoding 10 0 R
+>>
+endobj
+10 0 obj
+<</Type/Encoding
+/BaseEncoding/WinAnsiEncoding
+/Differences[0/.notdef
+/.notdef
+/.notdef
+128/.notdef
+130/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+142/.notdef
+145/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+158/.notdef
+/.notdef
+/space
+173/hyphen
+]
+>>
+endobj
+9 0 obj
+<</Type/FontDescriptor
+/Flags 262176
+/Ascent 718
+/CapHeight 718
+/Descent -207
+/FontBBox[-628 -376 2000 1010]
+/FontName/Helvetica-Bold
+/ItalicAngle 0
+/StemV 166
+/XHeight 532
+>>
+endobj
+3 0 obj
+<</Type/Page
+/Parent 2 0 R
+/Contents 4 0 R
+/Resources 7 0 R
+/MediaBox[0 0 612 500]
+>>
+endobj
+2 0 obj
+<</Type/Pages
+/Count 1
+/Kids[ 3 0 R]>>
+endobj
+11 0 obj
+<</Type/Catalog
+/Pages 2 0 R
+>>
+endobj
+xref
+0 12
+0000000000 65535 f
+0000000015 00000 n
+0000002385 00000 n
+0000002284 00000 n
+0000000063 00000 n
+0000000348 00000 n
+0000000537 00000 n
+0000000367 00000 n
+0000000422 00000 n
+0000002093 00000 n
+0000001708 00000 n
+0000002439 00000 n
+trailer
+<</Size 12
+/Root 11 0 R
+/Info 8 0 R
+/ID[<2E2949BF0CCA717C9B1FEA7F231B3F97><2E2949BF0CCA717C9B1FEA7F231B3F97>]
+>>
+startxref
+2487
+%%EOF
diff --git a/spec/textposition.py b/spec/textposition.py
new file mode 100644
index 00000000..4430716f
--- /dev/null
+++ b/spec/textposition.py
@@ -0,0 +1,54 @@
+from sys import *
+from pdflib_py import *
+from math import sin,cos
+p = PDF_new()
+PDF_open_file(p, "textposition.pdf")
+
+PDF_set_parameter(p, "usercoordinates", "true")
+
+width = 612
+height = 500
+PDF_begin_page(p, width, height)
+
+font = PDF_load_font(p, "Helvetica-Bold", "host", "")
+
+PDF_setfont(p, font, 18.0)
+
+a=0.7
+b=-0.7
+matrices = [[1,0,0,1,100,200],
+ [cos(a),sin(a),-sin(a),cos(a),400,75],
+ [1,0,0,-1,100,350],
+ [-1,0,0,1,450,270],
+ [1.9,0.5,0.6,1.4,50,-140],
+ [cos(b),sin(b),sin(b),-cos(b),100,300],
+ [1.0,0,0,5,-90,-200],
+ ]
+
+for m in matrices:
+ PDF_save(p)
+ PDF_setmatrix(p, m[0],m[1],m[2],m[3],m[4],m[5])
+ x,y = 100,100
+ PDF_set_text_pos(p, x,y)
+ w = PDF_stringwidth(p, "HELLO WORLD", font, 18.0)
+ h = 18.0 - 4
+ PDF_setrgbcolor_fill(p, 0.0, 0.0, 0.0)
+ PDF_show(p, "HELLO WORLD")
+
+ PDF_setrgbcolor_fill(p, 0.0, 0.0, 1.0)
+ PDF_moveto(p, x,y)
+ PDF_lineto(p, x+w,y)
+ PDF_lineto(p, x+w,y+h)
+ PDF_lineto(p, x,y+h)
+ PDF_lineto(p, x,y)
+ PDF_moveto(p, x-20,y-20)
+ PDF_lineto(p, x-20,y+20+h)
+ PDF_lineto(p, x+20+w,y+20+h)
+ PDF_lineto(p, x+20+w,y-20)
+ PDF_lineto(p, x-20,y-20)
+ PDF_fill(p);
+ PDF_restore(p)
+
+PDF_end_page(p)
+PDF_close(p)
+PDF_delete(p);