mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
3066c86e38
This is a major overhaul of the hardware abstraction layer. A few notes: General platform distinction happens in frontend/device.lua which will delegate everything else to frontend/device/<platform_name>/device.lua which should extend frontend/device/generic/device.lua Screen handling is implemented in frontend/device/screen.lua which includes the *functionality* to support device specifics. Actually setting up the device specific functionality, however, is done in the device specific setup code in the relevant device.lua file. The same goes for input handling.
30 lines
772 B
Lua
30 lines
772 B
Lua
local TextWidget = require("ui/widget/textwidget")
|
|
local RenderText = require("ui/rendertext")
|
|
local Geom = require("ui/geometry")
|
|
local Screen = require("device").screen
|
|
|
|
--[[
|
|
FixedTextWidget
|
|
--]]
|
|
local FixedTextWidget = TextWidget:new{}
|
|
|
|
function FixedTextWidget:getSize()
|
|
local tsize = RenderText:sizeUtf8Text(0, Screen:getWidth(), self.face, self.text, true, self.bold)
|
|
if not tsize then
|
|
return Geom:new{}
|
|
end
|
|
self._length = tsize.x
|
|
self._height = self.face.size
|
|
return Geom:new{
|
|
w = self._length,
|
|
h = self._height,
|
|
}
|
|
end
|
|
|
|
function FixedTextWidget:paintTo(bb, x, y)
|
|
RenderText:renderUtf8Text(bb, x, y+self._height, self.face, self.text, true, self.bold,
|
|
self.fgcolor)
|
|
end
|
|
|
|
return FixedTextWidget
|