mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 08:23:50 -04:00
Update bitwidget font handling to match PIL changes
This commit is contained in:
parent
86eb8f2e67
commit
dc7986f4fd
@ -28,7 +28,9 @@ class Label(Widget):
|
|||||||
self._spacing = spacing
|
self._spacing = spacing
|
||||||
self._align = align
|
self._align = align
|
||||||
self._strokeWidth = strokeWidth
|
self._strokeWidth = strokeWidth
|
||||||
self._bounds = FontManager.getFont(self.font).getsize(self.text)
|
|
||||||
|
(left, top, right, bottom) = FontManager.getFont(self.font).getbbox(self.text)
|
||||||
|
self._bounds = (right - left, bottom - top)
|
||||||
|
|
||||||
def draw(self, ctx):
|
def draw(self, ctx):
|
||||||
if self._visible:
|
if self._visible:
|
||||||
@ -62,17 +64,20 @@ class Label(Widget):
|
|||||||
@text.setter
|
@text.setter
|
||||||
def text(self, text):
|
def text(self, text):
|
||||||
self.setProperty('text', text)
|
self.setProperty('text', text)
|
||||||
self.bounds = FontManager.getFont(self.font).getsize(self.text)
|
(left, top, right, bottom) = FontManager.getFont(self.font).getbbox(self.text)
|
||||||
|
self.bounds = (right - left, bottom - top)
|
||||||
|
|
||||||
@font.setter
|
@font.setter
|
||||||
def font(self, font):
|
def font(self, font):
|
||||||
self.setProperty('font', font)
|
self.setProperty('font', font)
|
||||||
self.bounds = FontManager.getFont(self.font).getsize(self.text)
|
(left, top, right, bottom) = FontManager.getFont(self.font).getbbox(self.text)
|
||||||
|
self.bounds = (right - left, bottom - top)
|
||||||
|
|
||||||
@spacing.setter
|
@spacing.setter
|
||||||
def spacing(self, spacing):
|
def spacing(self, spacing):
|
||||||
self.setProperty('spacing', spacing)
|
self.setProperty('spacing', spacing)
|
||||||
self.bounds = FontManager.getFont(self.font).getsize(self.text)
|
(left, top, right, bottom) = FontManager.getFont(self.font).getbbox(self.text)
|
||||||
|
self.bounds = (right - left, bottom - top)
|
||||||
|
|
||||||
@align.setter
|
@align.setter
|
||||||
def align(self, align):
|
def align(self, align):
|
||||||
|
@ -141,7 +141,8 @@ class ListItem(Widget):
|
|||||||
self._isHighlighted = is_highlighted
|
self._isHighlighted = is_highlighted
|
||||||
|
|
||||||
self._font = font
|
self._font = font
|
||||||
(_, self._fontHeight) = FontManager.getFont(self._font).getsize('Wqpj')
|
(_, top, _, bottom) = FontManager.getFont(self._font).getbbox('Wqpj')
|
||||||
|
self._fontHeight = bottom - top
|
||||||
|
|
||||||
self.position = (0, ypos)
|
self.position = (0, ypos)
|
||||||
self.bounds = (DISPLAY_WIDTH, self._fontHeight + 3)
|
self.bounds = (DISPLAY_WIDTH, self._fontHeight + 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user