hide DPI dependency in Font module

pull/2/merge
chrox 11 years ago
parent 1be80d15ae
commit 21c972a786

@ -109,7 +109,7 @@ KoptOptions = {
name_text = "Contrast",
name_align_right = 0.2,
item_text = {"lightest", "lighter", "default", "darker", "darkest"},
item_font_size = math.floor(18*Screen:getDPI()/167),
item_font_size = 18,
item_align_center = 0.8,
values = {2.0, 1.5, 1.0, 0.5, 0.2},
default_value = 1.0,

@ -171,7 +171,7 @@ function ToggleSwitch:init()
self.position = nil
local label_font_face = "cfont"
local label_font_size = math.floor(16*Screen:getDPI()/167)
local label_font_size = 16
self.toggle_frame = FrameContainer:new{background = 0, color = 7, radius = 7, bordersize = 1, padding = 2,}
self.toggle_content = HorizontalGroup:new{}
@ -302,12 +302,11 @@ end
ConfigOption = CenterContainer:new{}
function ConfigOption:init()
local mag_ratio = Screen:getDPI()/167
local default_name_font_size = math.floor(20*mag_ratio)
local default_item_font_size = math.floor(16*mag_ratio)
local default_items_spacing = math.floor(30*mag_ratio)
local default_option_height = math.floor(50*mag_ratio)
local default_option_padding = math.floor(15*mag_ratio)
local default_name_font_size = 20
local default_item_font_size = 16
local default_items_spacing = 30
local default_option_height = 50
local default_option_padding = 15
local vertical_group = VerticalGroup:new{}
table.insert(vertical_group, VerticalSpan:new{ width = default_option_padding })
for c = 1, #self.options do

@ -43,6 +43,8 @@ function Font:getFace(font, size)
-- default to content font
font = self.cfont
end
local size = math.floor(size*Screen:getDPI()/167)
local face = self.faces[font..size]
-- build face if not found

@ -195,13 +195,13 @@ Widget that displays menu
--]]
Menu = FocusManager:new{
-- face for displaying item contents
cface = Font:getFace("cfont", math.floor(22*Screen:getDPI()/167)),
cface = Font:getFace("cfont", 22),
-- face for menu title
tface = Font:getFace("tfont", math.floor(25*Screen:getDPI()/167)),
tface = Font:getFace("tfont", 25),
-- face for paging info display
fface = Font:getFace("ffont", math.floor(16*Screen:getDPI()/167)),
fface = Font:getFace("ffont", 16),
-- font for item shortcut
sface = Font:getFace("scfont", math.floor(20*Screen:getDPI()/167)),
sface = Font:getFace("scfont", 20),
title = "No Title",
-- default width and height

Loading…
Cancel
Save