David PHAM-VAN

Fix some numeric conversion

... ... @@ -159,7 +159,7 @@ class PdfGraphics {
/// @param x coordinate
/// @param y coordinate
/// @oaran s String to draw
void drawString(PdfFont font, size, String s, double x, double y) {
void drawString(PdfFont font, double size, String s, double x, double y) {
if (!page.fonts.containsKey(font.name)) {
page.fonts[font.name] = font;
}
... ... @@ -180,7 +180,8 @@ class PdfGraphics {
/// Set the transformation Matrix
void setTransform(Matrix4 t) {
var s = t.storage;
buf.putString("${s[0]} ${s[1]} ${s[4]} ${s[5]} ${s[12]} ${s[13]} cm\n");
buf.putNumList(<double>[s[0], s[1], s[4], s[5], s[12], s[13]]);
buf.putString(" cm\n");
}
/// This adds a line segment to the current path
... ...
... ... @@ -19,6 +19,7 @@
part of pdf;
class PdfStream {
static const precision = 5;
final _stream = List<int>();
void putStream(PdfStream s) {
... ... @@ -49,7 +50,11 @@ class PdfStream {
}
void putNum(double d) {
putString(d.toString());
putString(d.toStringAsFixed(precision));
}
void putNumList(List<double> d) {
putString(d.map((v) => v.toStringAsFixed(precision)).join(" "));
}
static PdfStream num(double d) => PdfStream()..putNum(d);
... ...