diff --git a/frontend/ui/device/screen.lua b/frontend/ui/device/screen.lua index 788162dd1..83ea3d520 100644 --- a/frontend/ui/device/screen.lua +++ b/frontend/ui/device/screen.lua @@ -171,10 +171,6 @@ function Screen:scaleByDPI(px) return math.ceil(px * self:getDPI()/167) end -function Screen:rescaleByDPI(px) - return math.ceil(px * 167/self:getDPI()) -end - function Screen:getRotationMode() return self.cur_rotation_mode end diff --git a/frontend/ui/font.lua b/frontend/ui/font.lua index f457fc3aa..4c7a32a8a 100644 --- a/frontend/ui/font.lua +++ b/frontend/ui/font.lua @@ -54,6 +54,8 @@ function Font:getFace(font, size) font = self.cfont end + -- original size before scaling by screen DPI + local orig_size = size local size = Screen:scaleByDPI(size) local face = self.faces[font..size] @@ -72,7 +74,7 @@ function Font:getFace(font, size) self.faces[font..size] = face --DEBUG("getFace, found: "..realname.." size:"..size) end - return { size = size, ftface = face, hash = font..size } + return { size = size, orig_size = orig_size, ftface = face, hash = font..size } end function Font:_readList(target, dir, effective_dir) diff --git a/frontend/ui/rendertext.lua b/frontend/ui/rendertext.lua index 2b2b753c5..03a7e9464 100644 --- a/frontend/ui/rendertext.lua +++ b/frontend/ui/rendertext.lua @@ -73,8 +73,8 @@ function RenderText:getGlyph(face, charcode, bold, bgcolor, fgcolor) local rendered_glyph = face.ftface:renderGlyph(charcode, bgcolor, fgcolor, bold) if face.ftface:checkGlyph(charcode) == 0 then for index, font in pairs(Font.fallbacks) do - -- rescale face size by DPI since it will be scaled in getFace again - local fb_face = Font:getFace(font, Screen:rescaleByDPI(face.size)) + -- use original size before scaling by screen DPI + local fb_face = Font:getFace(font, face.orig_size) if fb_face.ftface:checkGlyph(charcode) ~= 0 then rendered_glyph = fb_face.ftface:renderGlyph(charcode, bgcolor, fgcolor, bold) --DEBUG("fallback to font", font)