From e9f48e74800a0f5a187f1a13312b23b6ce811a28 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Tue, 21 Aug 2012 22:22:56 +0200 Subject: [PATCH] don't write double in scientific notation --- src/HTMLRenderer/export.cc | 35 ++++++++++++++--------------------- src/HTMLRenderer/general.cc | 4 ++++ 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/HTMLRenderer/export.cc b/src/HTMLRenderer/export.cc index 3236ef2..c45b97a 100644 --- a/src/HTMLRenderer/export.cc +++ b/src/HTMLRenderer/export.cc @@ -102,29 +102,22 @@ void HTMLRenderer::export_transform_matrix (long long tm_id, const double * tm) // we have already shifted the origin // TODO: recognize common matices - if(_tm_equal(tm, id_matrix, 4)) + for(const string & prefix : {"", "-ms-", "-moz-", "-webkit-", "-o-"}) { - // no need to output anything - } - else - { - for(const string & prefix : {"", "-ms-", "-moz-", "-webkit-", "-o-"}) - { - // PDF use a different coordinate system from Web - allcss_fout << prefix << "transform:matrix(" - << tm[0] << ',' - << -tm[1] << ',' - << -tm[2] << ',' - << tm[3] << ','; + // PDF use a different coordinate system from Web + allcss_fout << prefix << "transform:matrix(" + << tm[0] << ',' + << -tm[1] << ',' + << -tm[2] << ',' + << tm[3] << ','; - allcss_fout << "0,0);"; - /* - if(prefix == "-moz-") - allcss_fout << format("%1%px,%2%px);") % tm[4] % -tm[5]; - else - allcss_fout << format("%1%,%2%);") % tm[4] % -tm[5]; - */ - } + allcss_fout << "0,0);"; + /* + if(prefix == "-moz-") + allcss_fout << format("%1%px,%2%px);") % tm[4] % -tm[5]; + else + allcss_fout << format("%1%,%2%);") % tm[4] % -tm[5]; + */ } allcss_fout << "}" << endl; } diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc index 5005681..5f7750b 100644 --- a/src/HTMLRenderer/general.cc +++ b/src/HTMLRenderer/general.cc @@ -14,6 +14,7 @@ #include "config.h" #include "namespace.h" +using std::fixed; using std::flush; using boost::filesystem::remove; using boost::filesystem::filesystem_error; @@ -105,6 +106,9 @@ void HTMLRenderer::pre_process() html_fout << ifstream(PDF2HTMLEX_DATA_PATH / NECK_HTML_FILENAME, ifstream::binary).rdbuf(); } + html_fout << fixed; + allcss_fout << fixed; + allcss_fout << ifstream(PDF2HTMLEX_DATA_PATH / CSS_FILENAME, ifstream::binary).rdbuf(); }