diff --git a/frontend/apps/reader/modules/readerlink.lua b/frontend/apps/reader/modules/readerlink.lua index 87625cba4..157c095c7 100644 --- a/frontend/apps/reader/modules/readerlink.lua +++ b/frontend/apps/reader/modules/readerlink.lua @@ -275,7 +275,13 @@ The footnote content may be empty, truncated, or include other footnotes. From the footnote popup, you can jump to the footnote location in the book by swiping to the left.]]), }) + local footnote_popup_settings_items = {} table.insert(menu_items.follow_links.sub_item_table, 5, { + text = _("Footnote popup settings"), + sub_item_table = footnote_popup_settings_items, + separator = true, + }) + table.insert(footnote_popup_settings_items, { text = _("Show more links as footnotes"), enabled_func = function() return isFootnoteLinkInPopupEnabled() and @@ -287,8 +293,23 @@ From the footnote popup, you can jump to the footnote location in the book by sw not isPreferFootnoteEnabled()) end, help_text = _([[Loosen footnote detection rules to show more links as footnotes.]]), + separator = true, }) - table.insert(menu_items.follow_links.sub_item_table, 6, { + table.insert(footnote_popup_settings_items, { + text = _("Use book font as popup font"), + enabled_func = function() + return isFootnoteLinkInPopupEnabled() and + (isTapToFollowLinksOn() or isSwipeToFollowNearestLinkEnabled()) + end, + checked_func = function() + return G_reader_settings:isTrue("footnote_popup_use_book_font") + end, + callback = function() + G_reader_settings:flipNilOrFalse("footnote_popup_use_book_font") + end, + help_text = _([[Display the footnote popup text with the font set as the document font (the book text may still render with a different font if the book uses embedded fonts).]]), + }) + table.insert(footnote_popup_settings_items, { text = _("Set footnote popup font size"), enabled_func = function() return isFootnoteLinkInPopupEnabled() and @@ -358,7 +379,6 @@ The recommended value is -2.]]), help_text = _([[ The footnote popup font adjusts to the font size you've set for the document. This allows you to specify how much smaller or larger it should be relative to the document font size.]]), - separator = true, }) end end @@ -1345,6 +1365,7 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location) local popup popup = FootnoteWidget:new{ html = html, + doc_font_name = self.ui.font.font_face, doc_font_size = Screen:scaleBySize(self.ui.font.font_size), doc_margins = self.ui.document:getPageMargins(), close_callback = close_callback, diff --git a/frontend/ui/widget/footnotewidget.lua b/frontend/ui/widget/footnotewidget.lua index 84633aa52..8ae1d45a4 100644 --- a/frontend/ui/widget/footnotewidget.lua +++ b/frontend/ui/widget/footnotewidget.lua @@ -21,26 +21,6 @@ local Screen = Device.screen local T = require("ffi/util").template local time = require("ui/time") --- If we wanted to use the default font set for the book, --- we'd need to add a few functions to crengine and cre.cpp --- to get the font files paths (for each font, regular, italic, --- bold...) so we can pass them to MuPDF with: --- @font-face { --- font-family: 'KOReader Footnote Font'; --- src: url("%1"); --- } --- @font-face { --- font-family: 'KOReader Footnote Font'; --- src: url("%2"); --- font-style: italic; --- } --- body { --- font-family: 'KOReader Footnote Font'; --- } --- But it looks quite fine if we use "Noto Sans": the difference in font look --- (Sans, vs probably Serif in the book) will help noticing this is a KOReader --- UI element, and somehow justify the difference in looks. - -- Note: we can't use < or > in comments in the CSS, or MuPDF complains with: -- error: css syntax error: unterminated comment. -- So, HTML tags in comments are written upppercase (eg: