lua-users home
lua-l archive

Re: [ANN] lua-users.org alternative wiki demo

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Le 18 févr. 08 à 03:36, Peter Sommerfeld a écrit :
Matt Campbell wrote
A nit pick about the style sheet: Why is the font size for the body of the page set to 75%? .... Yes, I know that most users don't change the font size in their browser preferences, but the default font isn't overly large.
The default font-size on modern browsers is 16 pixel which is overlay large imho, - a waste of space. Screen fonts are usually 12px(75%), 13px(81.25%;) or 14 px (87.5%). I agree that 75% is too small for normal text and should be reserved for annotations etc. I usually use 81.25% for normal text. That all depends on fonts, colors, line-height etc. but 13 or 14px usually fit.
Blueprint is nice, it take care of typography.
But defaults are way small for a full text content.
In my mind they have set defaults to suite designers.
Anyway, it simple to compute some new values :
in lua :)
 -- Font setting
 -- in % change all font size set 1em value
data.BASE_FONT_SIZE = content.BASE_FONT_SIZE or 75 --75% = 12px with default setting => 1em = 12px -- in em (BASE_FONT_SIZE); vertical grid step = LINE_HEIGHT * FONT_SIZE local DEFAULT_LINE_HEIGHT = content.DEFAULT_LINE_HEIGHT or 1.5 -- 12px*1.5 = 18px
 data.DEFAULT_LINE_HEIGHT = DEFAULT_LINE_HEIGHT
 local DH = DEFAULT_LINE_HEIGHT
 data.DEM = DH.."em"
 -- Take css selector,
 -- font_size in em : multiple of BASE_FONT_SIZE
 -- line_height,margin_bottom : multiple of DEFAULT_LINE_HEIGHT
 -- + extra style string
local function mk_step(css_selector,font_size,line_height,margin_bottom,extra)
 margin_bottom = margin_bottom or 1
 extra = extra or ""
return css_selector.." {font-size:"..font_size.."em;line- height:"..(DH*line_height/font_size)..";margin-bottom:".. (DH*margin_bottom/font_size).."em;"..extra.."}\n"
 end
 local function mk_all_step(t)
 local result = {}
 for i,s in pairs(t) do
 table.insert(result,mk_step(i,unpack(s)))
 end
 return table.concat(result)
 end
 -- Take css selector, size multiple of BASE_FONT_SIZE + extra style
 local default_step = {
 h1={ 3 ,2 ,1 ,""},
 h2={ 2 ,2 ,1 ,""},
 h3={ 1.5 ,1 ,1 ,""},
 h4={ 1.2 ,1 ,1 ,""},
 h5={ 1 ,1, 1, "font-weight:bold;"},
 h6={ 1 ,1, 0, "font-weight:bold;"},
 [".small"]={ 0.8, 1 ,1 ,""},
 [".large"]={ 1.2, 1 ,1 ,""},
 }
 if type(content.STEP) == "table" then
 for i,s in pairs(content.STEP) do
 default_step[i] = default_step[i] or {}
 for j,v in ipairs(content.STEP[i]) do
 default_step[i][j] = v
 end
 end
 end
 data.STEP = mk_all_step(default_step)
- pierre

AltStyle によって変換されたページ (->オリジナル) /