I was experimenting on Kivy and encountered a problem. I can easily change my label font using [font=font.ttf]Some text[/font], but noticed that I can't change font's weight. For example I have Helvetica Neue font on my computer, which can be Regular, Thin, UltraThin, etc. How am I supposed to change font's weight? Am I going to modify my HelveticaNeue.ttc file, because I didn't find anything helpful in kivy documentation?
Here is my code:
from random import random
from kivy.app import App
from kivy.uix.label import Label
from kivy.clock import Clock
from kivy.animation import Animation
from kivy.graphics import Color
class MyApp(App):
def on_touch_down(self, instance, touch):
color = Color(random(), 1, 1, mode='hsv').rgba
anim = Animation(font_size=300, color=color, duration=0.1)
anim.start(self.root)
def on_touch_up(self, instance, touch):
color = Color(random(), 1, 1, mode='hsv').rgba
anim = Animation(font_size=200, color=color, duration=0.1)
anim.start(self.root)
def build(self):
# Here I have changed font
return Label(
font_size=200,
text='[font=HelveticaNeue.ttc]text[/font]',
markup=True,
on_touch_down=self.on_touch_down,
on_touch_up=self.on_touch_up
)
if __name__ == '__main__':
MyApp().run()