Style tweaks: add "Tailor widths and text-indent for CJK"

Also add a timeout to the "Changed language for
typography rules" InfoMessages.
This commit is contained in:
poire-z
2022-06-05 12:36:31 +02:00
parent ccd527ee48
commit f29ee8475e
2 changed files with 11 additions and 0 deletions

View File

@@ -234,8 +234,11 @@ When the book's language tag is not among our presets, no specific features will
return text
end,
callback = function()
-- We use an InfoMessage because the text might be too long for a Notification.
-- Use a small timeout (but long enough to read) as this might be bothering.
UIManager:show(InfoMessage:new{
text = T(_("Changed language for typography rules to %1."), BD.wrap(lang_name)),
timeout = 2,
})
self.text_lang_tag = lang_tag
self.ui.document:setTextMainLang(lang_tag)
@@ -783,6 +786,7 @@ function ReaderTypography:onPreRenderDocument(config)
callback = function()
UIManager:show(InfoMessage:new{
text = T(_("Changed language for typography rules to book language: %1."), BD.wrap(self.book_lang_tag)),
timeout = 2,
})
self.text_lang_tag = self.book_lang_tag
self.ui.doc_settings:saveSetting("text_lang", self.text_lang_tag)

View File

@@ -430,6 +430,13 @@ p {
margin-bottom: 1em;
}
]],
},
{
id = "cjk_tailored";
title = _("Tailor widths and text-indent for CJK"),
description = _([[
Adjust paragraph width and text-indent to be an integer multiple of the font size, so that lines of Chinese and Japanese characters don't need space added between glyphs for text justification.]]),
css = [[ body { -cr-hint: cjk-tailored; }]], -- This hint is inherited
separator = true,
},
{