X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLength.cpp;h=d862f40213d3a4bdea1e834bc0f3cf586d1b1616;hb=aef78c821f0efbece98490a765c57b021cef0d8b;hp=35f6b0cb424060116e30511e127867e173227641;hpb=ccbac353eaea45f8480523caba9c0697cb3eacb2;p=lyx.git diff --git a/src/Length.cpp b/src/Length.cpp index 35f6b0cb42..d862f40213 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -23,6 +23,7 @@ #include "support/docstream.h" #include "support/lstrings.h" +#include "support/lyxlib.h" #include #include @@ -75,7 +76,8 @@ docstring const Length::asDocstring() const { odocstringstream os; if (unit_ != UNIT_NONE) - os << formatFPNumber(val_) << unit_name[unit_]; // setw? + os << from_ascii(formatFPNumber(val_)) + << from_ascii(unit_name[unit_]); // setw? return os.str(); } @@ -214,7 +216,7 @@ int Length::inPixels(int text_width, int em_width_base) const double const text_width_in = text_width / (zoom * dpi); double const result = zoom * dpi * inInch(text_width_in, em_width_in); - return static_cast(result + ((result >= 0) ? 0.5 : -0.5)); + return support::iround(result); } @@ -310,7 +312,7 @@ int Length::inBP() const double const text_width_in = 210.0 / 2.54; // assume A4 double const em_width_in = 10.0 / 72.27; double result = 72.0 * inInch(text_width_in, em_width_in); - return static_cast(result + 0.5); + return support::iround(result); }