Mercurial > libervia-desktop-kivy
diff libervia/desktop_kivy/core/common.py @ 518:196483685a63 default tip
Use Font-Awesome instead of Fontello, following change in Libervia Media.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 26 Oct 2024 22:44:37 +0200 |
parents | d1a023280733 |
children |
line wrap: on
line diff
--- a/libervia/desktop_kivy/core/common.py Sat Jul 13 13:08:13 2024 +0200 +++ b/libervia/desktop_kivy/core/common.py Sat Oct 26 22:44:37 2024 +0200 @@ -175,13 +175,23 @@ def __init__(self, **kwargs): if self.symbol_map is None: - with open(G.host.app.expand('{media}/fonts/fontello/config.json')) as f: - fontello_conf = json.load(f) - Symbol.symbol_map = {g['css']:g['code'] for g in fontello_conf['glyphs']} + with open( + G.host.app.expand('{media}/fonts/fontawesome/metadata/icons.json') + ) as f: + font_conf = json.load(f) + Symbol.symbol_map = { + name:int(data["unicode"], 16) + for name, data in font_conf.items() + } super(Symbol, self).__init__(**kwargs) def on_symbol(self, instance, symbol): + if symbol.startswith("regular "): + symbol = symbol[8:] + self.font_name = G.host.app.expand( + "{media}/fonts/fontawesome/webfonts/fa-regular-400.ttf" + ) try: code = self.symbol_map[symbol] except KeyError: