mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
@@ -82,7 +82,7 @@ function ReaderFont:init()
|
||||
end
|
||||
end,
|
||||
callback = function()
|
||||
self:setFont(v)
|
||||
self:onSetFont(v)
|
||||
end,
|
||||
hold_callback = function(touchmenu_instance)
|
||||
self:makeDefault(v, touchmenu_instance)
|
||||
@@ -283,7 +283,7 @@ function ReaderFont:onSaveSettings()
|
||||
self.ui.doc_settings:saveSetting("gamma_index", self.gamma_index)
|
||||
end
|
||||
|
||||
function ReaderFont:setFont(face)
|
||||
function ReaderFont:onSetFont(face)
|
||||
if face and self.font_face ~= face then
|
||||
self.font_face = face
|
||||
self.ui.document:setFontFace(face)
|
||||
|
||||
@@ -133,6 +133,7 @@ local settingsList = {
|
||||
panel_zoom_toggle = {category="none", event="TogglePanelZoomSetting", title=_("Toggle panel zoom"), paging=true, separator=true},
|
||||
|
||||
-- rolling reader settings
|
||||
set_font = {category="string", event="SetFont", title=_("Set font"), rolling=true, args_func=require("fontlist").getFontArgFunc,},
|
||||
increase_font = {category="incrementalnumber", event="IncreaseFontSize", min=0.5, max=255, step=0.5, title=_("Increase font size by %1"), rolling=true},
|
||||
decrease_font = {category="incrementalnumber", event="DecreaseFontSize", min=0.5, max=255, step=0.5, title=_("Decrease font size by %1"), rolling=true},
|
||||
|
||||
@@ -288,6 +289,7 @@ local dispatcher_menu_order = {
|
||||
"book_description",
|
||||
"book_cover",
|
||||
|
||||
"set_font",
|
||||
"increase_font",
|
||||
"decrease_font",
|
||||
"font_size",
|
||||
|
||||
@@ -233,4 +233,14 @@ function FontList:getLocalizedFontName(file, index)
|
||||
return altname
|
||||
end
|
||||
|
||||
function FontList:getFontArgFunc()
|
||||
require("document/credocument"):engineInit()
|
||||
local toggle = {}
|
||||
local face_list = cre.getFontFaces()
|
||||
for k,v in ipairs(face_list) do
|
||||
table.insert(toggle, FontList:getLocalizedFontName(cre.getFontFaceFilenameAndFaceIndex(v)) or v)
|
||||
end
|
||||
return face_list, toggle
|
||||
end
|
||||
|
||||
return FontList
|
||||
|
||||
Reference in New Issue
Block a user