remove rescaleByDPI since it's not reversible

alternatively we store the original size before scaling by screen DPI
and use that value when needed.
pull/818/head
chrox 10 years ago
parent e3af23f5ef
commit 56fa8a45b7

@ -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

@ -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)

@ -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)

Loading…
Cancel
Save