Showing
2 changed files
with
9 additions
and
3 deletions
@@ -159,7 +159,7 @@ class PdfGraphics { | @@ -159,7 +159,7 @@ class PdfGraphics { | ||
159 | /// @param x coordinate | 159 | /// @param x coordinate |
160 | /// @param y coordinate | 160 | /// @param y coordinate |
161 | /// @oaran s String to draw | 161 | /// @oaran s String to draw |
162 | - void drawString(PdfFont font, size, String s, double x, double y) { | 162 | + void drawString(PdfFont font, double size, String s, double x, double y) { |
163 | if (!page.fonts.containsKey(font.name)) { | 163 | if (!page.fonts.containsKey(font.name)) { |
164 | page.fonts[font.name] = font; | 164 | page.fonts[font.name] = font; |
165 | } | 165 | } |
@@ -180,7 +180,8 @@ class PdfGraphics { | @@ -180,7 +180,8 @@ class PdfGraphics { | ||
180 | /// Set the transformation Matrix | 180 | /// Set the transformation Matrix |
181 | void setTransform(Matrix4 t) { | 181 | void setTransform(Matrix4 t) { |
182 | var s = t.storage; | 182 | var s = t.storage; |
183 | - buf.putString("${s[0]} ${s[1]} ${s[4]} ${s[5]} ${s[12]} ${s[13]} cm\n"); | 183 | + buf.putNumList(<double>[s[0], s[1], s[4], s[5], s[12], s[13]]); |
184 | + buf.putString(" cm\n"); | ||
184 | } | 185 | } |
185 | 186 | ||
186 | /// This adds a line segment to the current path | 187 | /// This adds a line segment to the current path |
@@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
19 | part of pdf; | 19 | part of pdf; |
20 | 20 | ||
21 | class PdfStream { | 21 | class PdfStream { |
22 | + static const precision = 5; | ||
22 | final _stream = List<int>(); | 23 | final _stream = List<int>(); |
23 | 24 | ||
24 | void putStream(PdfStream s) { | 25 | void putStream(PdfStream s) { |
@@ -49,7 +50,11 @@ class PdfStream { | @@ -49,7 +50,11 @@ class PdfStream { | ||
49 | } | 50 | } |
50 | 51 | ||
51 | void putNum(double d) { | 52 | void putNum(double d) { |
52 | - putString(d.toString()); | 53 | + putString(d.toStringAsFixed(precision)); |
54 | + } | ||
55 | + | ||
56 | + void putNumList(List<double> d) { | ||
57 | + putString(d.map((v) => v.toStringAsFixed(precision)).join(" ")); | ||
53 | } | 58 | } |
54 | 59 | ||
55 | static PdfStream num(double d) => PdfStream()..putNum(d); | 60 | static PdfStream num(double d) => PdfStream()..putNum(d); |
-
Please register or login to post a comment