mirror of https://github.com/kivy/kivy.git
label: removed px hack for font_size + updated the font_size to 13dp (instead of 10).
This commit is contained in:
parent
0059e9c2b3
commit
36e45c198a
|
@ -140,7 +140,7 @@ class MarkupLabel(MarkupLabelBase):
|
|||
elif item[:6] == '[size=':
|
||||
item = item[6:-1]
|
||||
try:
|
||||
if item[-2:] in ('px', 'pt', 'in', 'cm', 'mm'):
|
||||
if item[-2:] in ('px', 'pt', 'in', 'cm', 'mm', 'dp'):
|
||||
size = dpi2px(item[:-2], item[-2:])
|
||||
else:
|
||||
size = int(item)
|
||||
|
|
|
@ -15,7 +15,7 @@ strings::
|
|||
l = Label(text='Multi\\nLine')
|
||||
|
||||
# size
|
||||
l = Label(text='Hello world', font_size=20)
|
||||
l = Label(text='Hello world', font_size='20dp')
|
||||
|
||||
Markup text
|
||||
-----------
|
||||
|
@ -148,9 +148,6 @@ class Label(Widget):
|
|||
# markup have change, we need to change our rendering method.
|
||||
d = Label._font_properties
|
||||
dkw = dict(zip(d, [getattr(self, x) for x in d]))
|
||||
# XXX font_size core provider compatibility
|
||||
if Label.font_size.get_format(self) == 'px':
|
||||
dkw['font_size'] *= 1.333
|
||||
if markup:
|
||||
self._label = CoreMarkupLabel(**dkw)
|
||||
else:
|
||||
|
@ -166,9 +163,6 @@ class Label(Widget):
|
|||
elif name == 'text_size':
|
||||
self._label.usersize = value
|
||||
elif name == 'font_size':
|
||||
# XXX font_size core provider compatibility
|
||||
if Label.font_size.get_format(self) == 'px':
|
||||
value *= 1.333
|
||||
self._label.options[name] = value
|
||||
else:
|
||||
self._label.options[name] = value
|
||||
|
@ -274,11 +268,11 @@ class Label(Widget):
|
|||
'DroidSans'.
|
||||
'''
|
||||
|
||||
font_size = NumericProperty('12px')
|
||||
font_size = NumericProperty('14dp')
|
||||
'''Font size of the text, in pixels.
|
||||
|
||||
:data:`font_size` is a :class:`~kivy.properties.NumericProperty`, default to
|
||||
12.
|
||||
12dp.
|
||||
'''
|
||||
|
||||
bold = BooleanProperty(False)
|
||||
|
@ -379,7 +373,7 @@ class Label(Widget):
|
|||
|
||||
l = Label(text='Hello world')
|
||||
# l.texture is good
|
||||
l.font_size = 50
|
||||
l.font_size = '50dp'
|
||||
# l.texture is not updated yet
|
||||
l.update_texture()
|
||||
# l.texture is good now.
|
||||
|
|
|
@ -1171,15 +1171,9 @@ class TextInput(Widget):
|
|||
|
||||
def _get_line_options(self):
|
||||
# Get or create line options, to be used for Label creation
|
||||
|
||||
# XXX font_size core label compatibility
|
||||
factor = 1.
|
||||
if TextInput.font_size.get_format(self) == 'px':
|
||||
factor = 1.333
|
||||
|
||||
if self._line_options is None:
|
||||
self._line_options = kw = {
|
||||
'font_size': self.font_size * factor,
|
||||
'font_size': self.font_size,
|
||||
'font_name': self.font_name,
|
||||
'anchor_x': 'left',
|
||||
'anchor_y': 'top',
|
||||
|
@ -1714,7 +1708,7 @@ class TextInput(Widget):
|
|||
'DroidSans'.
|
||||
'''
|
||||
|
||||
font_size = NumericProperty(10)
|
||||
font_size = NumericProperty('13dp')
|
||||
'''Font size of the text, in pixels.
|
||||
|
||||
:data:`font_size` is a :class:`~kivy.properties.NumericProperty`, default to
|
||||
|
|
Loading…
Reference in New Issue