2
0
mirror of https://github.com/koreader/koreader synced 2024-11-04 12:00:25 +00:00
koreader/frontend/ui/widget/fixedtextwidget.lua

26 lines
575 B
Lua
Raw Normal View History

2013-10-18 20:38:07 +00:00
local TextWidget = require("ui/widget/textwidget")
local Geom = require("ui/geometry")
--[[
FixedTextWidget
--]]
local FixedTextWidget = TextWidget:new{}
function FixedTextWidget:updateSize()
TextWidget.updateSize(self)
-- Only difference from TextWidget:
-- no vertical padding, baseline is height
2014-03-13 13:52:43 +00:00
self._height = self.face.size
self._baseline_h = self.face.size
2013-10-18 20:38:07 +00:00
end
function FixedTextWidget:getSize()
self:updateSize()
if self._length == 0 then
return Geom:new{}
end
return TextWidget.getSize(self)
2013-10-18 20:38:07 +00:00
end
return FixedTextWidget