Update UI layout code to use new SVG icons

- Add IconWidget, use it for icons instead of ImageWidget.
  Specify icons by name only, look for them (with either
  .svg or .png suffixes) in multiple directories (including
  koreader/settings/icons/ to allow customizing them).
  Don't crash when icon name not found, shown a black
  background warning icon instead.
- Don't trust the icons' native sizes: replace
  scale_for_dpi=true with width/height=DGENERIC_ICON_SIZE,
  so all icons get the same (tunable) size - except in
  a few specific use cases.
- Top and bottom menu bars: normalize, and have icons
  properly centered in them, extend vertical line
  separators up to the edges.
- TOC: adjust expand/collapse icons size to items size
This commit is contained in:
poire-z
2020-12-19 12:18:30 +01:00
parent f0b09fb4b3
commit 24424e505e
41 changed files with 379 additions and 228 deletions

View File

@@ -6,7 +6,7 @@ local bit = require("bit")
local Font = require("ui/font")
local Cache = require("cache")
local CacheItem = require("cacheitem")
local BlitBuffer = require("ffi/blitbuffer")
local Blitbuffer = require("ffi/blitbuffer")
local Device = require("device")
local logger = require("logger")
@@ -207,7 +207,7 @@ end
-- @string text text to render
-- @bool[opt=false] kerning whether the text should be measured with kerning
-- @bool[opt=false] bold whether the text should be measured as bold
-- @tparam[opt=BlitBuffer.COLOR_BLACK] BlitBuffer.COLOR fgcolor foreground color
-- @tparam[opt=Blitbuffer.COLOR_BLACK] Blitbuffer.COLOR fgcolor foreground color
-- @int[opt=nil] width maximum rendering width
-- @tparam[opt] table char_pads array of integers, nb of pixels to add, one for each utf8 char in text
-- @return int width of rendered bitmap
@@ -218,7 +218,7 @@ function RenderText:renderUtf8Text(dest_bb, x, baseline, face, text, kerning, bo
end
if not fgcolor then
fgcolor = BlitBuffer.COLOR_BLACK
fgcolor = Blitbuffer.COLOR_BLACK
end
-- may still need more adaptive pen placement when kerning,