[LyX/master] Fix on-screen representation of pagewidth length (#13309)
Juergen Spitzmueller <[email protected]> Thu, 07 May 2026 15:38:12 +0000
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 467c7281c92d1b1f19c7781104150f185b823364 Author: Juergen Spitzmueller <[email protected]> Date: Thu May 7 17:37:35 2026 +0200 Fix on-screen representation of pagewidth length (#13309) --- src/support/Length.cpp | 13 +++++++------ src/support/Length.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/support/Length.cpp b/src/support/Length.cpp index 28fb86bfc6..f5c723f543 100644 --- a/src/support/Length.cpp +++ b/src/support/Length.cpp @@ -100,7 +100,7 @@ string const Length::asLatexString() const break; default: os << formatFPNumber(val_) << unit_name[unit_]; - break; + break; } return os.str(); } @@ -170,12 +170,13 @@ int Length::inPixels(int text_width, int em_width_base) const // is the same as on paper. double const text_width_in = text_width / (zoom * dpi); - double const result = zoom * dpi * inInch(text_width_in, em_width_in); + double const margin = 40 / (zoom * dpi); + double const result = zoom * dpi * inInch(text_width_in, em_width_in, margin); return support::iround(result); } -double Length::inInch(double text_width, double em_width) const +double Length::inInch(double text_width, double em_width, double margin) const { double result = 0.0; @@ -236,8 +237,7 @@ double Length::inInch(double text_width, double em_width) const result = val_ * text_width / 100; break; case Length::PPW: - // paperwidth/textwidth is 1.7 for A4 paper with default margins - result = val_ * text_width * 1.7 / 100; + result = val_ * (text_width + margin) / 100; break; case Length::PTH: result = val_ * text_width * 1.787 / 100; @@ -266,7 +266,8 @@ 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 const result = 72.0 * inInch(text_width_in, em_width_in); + double const margin = 40.0 / 72.27; + double const result = 72.0 * inInch(text_width_in, em_width_in, margin); return support::iround(result); } diff --git a/src/support/Length.h b/src/support/Length.h index cd0ad81012..7863a9cfa5 100644 --- a/src/support/Length.h +++ b/src/support/Length.h @@ -109,7 +109,7 @@ public: private: /// Convert value to inch for text width and em width given in inch - double inInch(double text_width, double em_width) const; + double inInch(double text_width, double em_width, double margin) const; /// double val_ = 0; /// -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs