mirror of https://github.com/kivy/kivy.git
PIL text provider: use `get_bbox` when `get_size` is not available. Allows latest versions of pillow to work along with older ones. (#8503)
This commit is contained in:
parent
3d045cd6ab
commit
49b81cb224
|
@ -34,11 +34,16 @@ class LabelPIL(LabelBase):
|
|||
|
||||
def get_extents(self, text):
|
||||
font = self._select_font()
|
||||
w, h = font.getsize(text)
|
||||
try:
|
||||
w, h = font.getsize(text)
|
||||
except AttributeError:
|
||||
left, top, right, bottom = font.getbbox(text)
|
||||
w = right - left
|
||||
h = bottom
|
||||
return w, h
|
||||
|
||||
def get_cached_extents(self):
|
||||
return self._select_font().getsize
|
||||
return self.get_extents
|
||||
|
||||
def _render_begin(self):
|
||||
# create a surface, context, font...
|
||||
|
|
Loading…
Reference in New Issue