mirror of https://github.com/kivy/kivy.git
Merge branch 'master' of ssh://github.com/kivy/kivy
This commit is contained in:
commit
97e4555ff0
|
@ -0,0 +1,19 @@
|
||||||
|
from kivy.app import App
|
||||||
|
from kivy.lang import Builder
|
||||||
|
|
||||||
|
root = Builder.load_string('''
|
||||||
|
Label:
|
||||||
|
text:
|
||||||
|
('[b]Hello[/b] [color=ff0099]World[/color]\\n'
|
||||||
|
'[color=ff0099]Hello[/color] [b]World[/b]\\n'
|
||||||
|
'[b]Hello[/b] [color=ff0099]World[/color]')
|
||||||
|
markup: True
|
||||||
|
font_size: '64pt'
|
||||||
|
''')
|
||||||
|
|
||||||
|
class LabelWithMarkup(App):
|
||||||
|
def build(self):
|
||||||
|
return root
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
LabelWithMarkup().run()
|
|
@ -217,14 +217,15 @@ class MarkupLabel(MarkupLabelBase):
|
||||||
uw, uh = self.text_size
|
uw, uh = self.text_size
|
||||||
|
|
||||||
# split the word
|
# split the word
|
||||||
|
default_line_height = get_extents(' ')[1]
|
||||||
for part in re.split(r'( |\n)', word):
|
for part in re.split(r'( |\n)', word):
|
||||||
|
|
||||||
if part == '':
|
if part == '':
|
||||||
part = ' '
|
continue
|
||||||
|
|
||||||
if part == '\n':
|
if part == '\n':
|
||||||
# put a new line!
|
# put a new line!
|
||||||
line = [0, 0, []]
|
line = [0, default_line_height, []]
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -310,26 +311,18 @@ class MarkupLabel(MarkupLabelBase):
|
||||||
# create texture is necessary
|
# create texture is necessary
|
||||||
texture = self.texture
|
texture = self.texture
|
||||||
mipmap = self.options['mipmap']
|
mipmap = self.options['mipmap']
|
||||||
if texture is None:
|
if texture is None or \
|
||||||
if data is None:
|
self.width != texture.width or \
|
||||||
if platform() in ('android', 'ios'):
|
self.height != texture.height:
|
||||||
colorfmt = 'rgba'
|
texture = Texture.create_from_data(data, mipmap=mipmap)
|
||||||
else:
|
data = None
|
||||||
colorfmt = 'luminance_alpha'
|
|
||||||
texture = Texture.create(
|
|
||||||
size=self.size, colorfmt=colorfmt,
|
|
||||||
mipmap=mipmap)
|
|
||||||
else:
|
|
||||||
texture = Texture.create_from_data(data, mipmap=mipmap)
|
|
||||||
texture.flip_vertical()
|
|
||||||
elif self.width != texture.width or self.height != texture.height:
|
|
||||||
if data is None:
|
|
||||||
texture = Texture.create(size=self.size, mipmap=mipmap)
|
|
||||||
else:
|
|
||||||
texture = Texture.create_from_data(data, mipmap=mipmap)
|
|
||||||
texture.flip_vertical()
|
texture.flip_vertical()
|
||||||
|
texture.add_reload_observer(self._texture_refresh)
|
||||||
|
self.texture = texture
|
||||||
|
|
||||||
# update texture
|
# update texture
|
||||||
self.texture = texture
|
# If the text is 1px width, usually, the data is black.
|
||||||
self.texture.blit_data(data)
|
# Don't blit that kind of data, otherwise, you have a little black bar.
|
||||||
|
if data is not None and data.width > 1:
|
||||||
|
texture.blit_data(data)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
cdef class Property:
|
cdef class Property:
|
||||||
cdef str _name
|
cdef str _name
|
||||||
cdef int allownone
|
cdef int allownone
|
||||||
cdef object defaultvalue
|
cdef public object defaultvalue
|
||||||
cdef init_storage(self, object obj, dict storage)
|
cdef init_storage(self, object obj, dict storage)
|
||||||
cpdef link(self, object obj, str name)
|
cpdef link(self, object obj, str name)
|
||||||
cpdef link_deps(self, object obj, str name)
|
cpdef link_deps(self, object obj, str name)
|
||||||
|
|
Loading…
Reference in New Issue