X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLength.cpp;h=d862f40213d3a4bdea1e834bc0f3cf586d1b1616;hb=1639abb8edaa492c649e69d093436f8a96f07bec;hp=44c3c8137161d1ace6f0c31c316ad8fa46f979f8;hpb=79f11f4e7daadcbf6977e50820d6bd01e6e690b3;p=lyx.git diff --git a/src/Length.cpp b/src/Length.cpp index 44c3c81371..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 @@ -215,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); } @@ -311,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); }