[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 06/10: [troff]: Clamp line, title lengths to hor res.
From: |
G. Branden Robinson |
Subject: |
[groff] 06/10: [troff]: Clamp line, title lengths to hor res. |
Date: |
Mon, 6 Sep 2021 15:01:24 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 6e19da2ab0e360d5e48e5ef93ed32e6d703535a5
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Sep 6 02:36:14 2021 +1000
[troff]: Clamp line, title lengths to hor res.
[troff]: Clamp line and title lengths to device horizontal resolution.
* src/roff/troff/env.cpp (line_length, title_length): Do it.
Prompted by <https://savannah.gnu.org/bugs/?61089>.
---
ChangeLog | 9 +++++++++
src/roff/troff/env.cpp | 16 ++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 10012ba..3ec8a2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2021-09-06 G. Branden Robinson <g.branden.robinson@gmail.com>
+ [troff]: Clamp line and title lengths to device horizontal
+ resolution.
+
+ * src/roff/troff/env.cpp (line_length, title_length): Do it.
+
+ Prompted by <https://savannah.gnu.org/bugs/?61089>.
+
+2021-09-06 G. Branden Robinson <g.branden.robinson@gmail.com>
+
* src/roff/troff/env.cpp (do_hyphenation_patterns_file):
Refactor slightly. Demote `append` from `int` to `bool`.
(hyphenation_patterns_file, hyphenation_patterns_file_append):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 68d0dc2..f918c57 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1343,10 +1343,12 @@ void right_justify()
void line_length()
{
hunits temp;
+ hunits minimum_length = font::hor;
if (has_arg() && get_hunits(&temp, 'm', curenv->line_length)) {
- if (temp < H0) {
- warning(WARN_RANGE, "bad line length %1u", temp.to_units());
- temp = H0;
+ if (temp < minimum_length) {
+ warning(WARN_RANGE, "invalid line length %1u rounded to device"
+ " horizontal resolution", temp.to_units());
+ temp = minimum_length;
}
}
else
@@ -1360,10 +1362,12 @@ void line_length()
void title_length()
{
hunits temp;
+ hunits minimum_length = font::hor;
if (has_arg() && get_hunits(&temp, 'm', curenv->title_length)) {
- if (temp < H0) {
- warning(WARN_RANGE, "bad title length %1u", temp.to_units());
- temp = H0;
+ if (temp < minimum_length) {
+ warning(WARN_RANGE, "invalid title length %1u rounded to device"
+ " horizontal resolution", temp.to_units());
+ temp = minimum_length;
}
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 06/10: [troff]: Clamp line, title lengths to hor res.,
G. Branden Robinson <=