aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-02-21 10:55:50 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-02-23 11:31:33 +0100
commit0f23a86b9d351d04769e3c60e65d55858cdcea6f (patch)
treecc692e22fca85a9d14a7ae23025d402c9f0d747d /src
parent53ff9f5a0cc68bdef348b585120914476a9df848 (diff)
downloadkristall-0f23a86b9d351d04769e3c60e65d55858cdcea6f.tar.gz
More consistent line height in headings and preformatted blocks
Also updates help.gemini to reflect changes
Diffstat (limited to 'src')
-rw-r--r--src/about/help.gemini4
-rw-r--r--src/documentstyle.cpp2
-rw-r--r--src/renderers/geminirenderer.cpp9
3 files changed, 12 insertions, 3 deletions
diff --git a/src/about/help.gemini b/src/about/help.gemini
index dd204a5..98c74fa 100644
--- a/src/about/help.gemini
+++ b/src/about/help.gemini
@@ -1,5 +1,5 @@
# Kristall Help
-This is the manual for the Kristall small-internet browser. It contains explanations on how to use the program, what each setting means and
+This is the manual for the Kristall small-internet browser. It contains explanations on how to use the program, what each setting means and other information about the browser.
## The Mission
Kristall tries to fill the hole of graphical browsers for alternative internet protocols with a high usability and feature richness.
@@ -197,7 +197,7 @@ Most items in the *Style* category have either a [Font], [Color] or both buttons
[Line height (paragraph)] is an additional spacing between paragraph text lines. By default this is set to 5px, and can help with readability. (Gemtext-only feature)
-[Line height (header)] is an additional spacing between header text lines. By default this is set to 0px. Pages will usually look better when this is set to a low value, or else headings will appear too far from paragraph text. (Gemtext-only feature)
+[Line height (header)] is an additional spacing between header text lines. By default this is set to 5px. (Gemtext-only feature)
[Indentation] is a set of options that control the level of indent in certain text parts in Gemini pages.
diff --git a/src/documentstyle.cpp b/src/documentstyle.cpp
index 6023075..815a647 100644
--- a/src/documentstyle.cpp
+++ b/src/documentstyle.cpp
@@ -146,7 +146,7 @@ DocumentStyle::DocumentStyle(bool do_init) : theme(Fixed),
justify_text(true),
text_width_enabled(true),
line_height_p(5.0),
- line_height_h(0.0),
+ line_height_h(5.0),
indent_bq(1), indent_p(1), indent_h(0), indent_l(2),
indent_size(15.0),
list_symbol(QTextListFormat::ListDisc)
diff --git a/src/renderers/geminirenderer.cpp b/src/renderers/geminirenderer.cpp
index 09ff494..be702e4 100644
--- a/src/renderers/geminirenderer.cpp
+++ b/src/renderers/geminirenderer.cpp
@@ -66,6 +66,15 @@ std::unique_ptr<GeminiDocument> GeminiRenderer::render(
{
if (line.startsWith("```"))
{
+ // Set the last line of the preformatted block to have
+ // standard line height.
+ QTextBlockFormat fmt = text_style.preformatted_format;
+ fmt.setLineHeight(themed_style.line_height_p,
+ QTextBlockFormat::LineDistanceHeight);
+ cursor.movePosition(QTextCursor::PreviousBlock);
+ cursor.setBlockFormat(fmt);
+
+ cursor.movePosition(QTextCursor::NextBlock);
cursor.setBlockFormat(text_style.standard_format);
verbatim = false;
}