Skip to content

[InfoMessage] stop force_one_line if font is too small#13337

Merged
Frenzie merged 7 commits into
koreader:masterfrom
Commodore64user:info-loop
Mar 3, 2025
Merged

[InfoMessage] stop force_one_line if font is too small#13337
Frenzie merged 7 commits into
koreader:masterfrom
Commodore64user:info-loop

Conversation

@Commodore64user

@Commodore64user Commodore64user commented Feb 27, 2025

Copy link
Copy Markdown
Member

what's new

  • frontend/ui/widget/infomessage.lua: Added logic to store the original font and size when force_one_line is enabled, preventing excessive font size reduction.
  • frontend/ui/widget/infomessage.lua: Implemented a condition to stop reducing the font size by more than 30 percent and reset to the original font and size if necessary.

related to #13107


This change is Reviewable

@Frenzie Frenzie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer to see a size we explicitly visually picked (cf. font definitions) rather than some fairly random 70% but I suppose it's fine. Pinging @poire-z

Comment thread frontend/ui/widget/infomessage.lua Outdated
end
end
if self.force_one_line and orig_size < self._initial_orig_size * 0.7 then
-- Do not reduce the font size by more than 30 percent, at around orig_size 15 or 16 (30% of defualt font size), our font is too small

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must admit that it took me quite a while to find where the typo was, ;)

@poire-z

poire-z commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

I agree some minimal font size (like we have a few around, i remember in CoverBrowser I set some when reducing title or authors) feels better than a random % made from what's ok with the default font size).

(Even if self.force_one_line 's real name is self.fits_anal_retentive_commodore64user_use_case.)

@Commodore64user Commodore64user changed the title [InfoMessage] stop force_one_line if reduction > 30pc [InfoMessage] stop force_one_line if font is xx_small Mar 3, 2025
Comment thread frontend/ui/widget/infomessage.lua Outdated
Comment on lines +211 to +212
if self.force_one_line and orig_font == "xx_smallinfofont" and orig_size < 16 then
-- Do not reduce the font size any longer, at around this point, our font is too small for the max_height check to be useful

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pick a min size - no matter the font name or nickname.

In other places we go smaller than 16 - but up to you for this "feature".

if orig_size > 10 then -- don't go too small

-- Don't go too low, and get out of this loop.
if fixed_font_size or fontsize_title <= 12 or fontsize_authors <= 10 then
local title_height = wtitle:getSize().h
local title_line_height = wtitle:getLineHeight()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, in this feature, (note the missing " ") going below means the box trick stops working because two lines of text at those small sizes are still less than the height of icon_heinght. so it makes no sense to continue reducing the font if we know the check no longer makes sense.

@Commodore64user Commodore64user requested a review from poire-z March 3, 2025 19:06
@Frenzie Frenzie added this to the 2025.02 milestone Mar 3, 2025
@Frenzie Frenzie changed the title [InfoMessage] stop force_one_line if font is xx_small [InfoMessage] stop force_one_line if font is too small Mar 3, 2025
@Frenzie Frenzie merged commit 154ec62 into koreader:master Mar 3, 2025
@Commodore64user Commodore64user deleted the info-loop branch March 3, 2025 22:13
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants