T-Dynamos / materialsymbols-python

Get all the possible combination of Material Symbols in Truetype format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

materialsymbols-python

GitHub repo size img

Get all the possible combination of Material Symbols!

This repo provides fonts in fonts/ path. You can also use generator.py to generate latest fonts yourself. These will be saved in fonts/ dir.

Format of fonts: Material_Symbols_<FONT_TYPE>-<OPTICAL_SIZE>-<WEIGHT>-<FILL>_<GRAD>.ttf

Example : https://github.com/T-Dynamos/materialsymbols-python/raw/main/fonts/Material_Symbols_Outlined-20-100-0_-25.ttf

Possible values:

# Possible values
FONT_TYPE = ["Outlined", "Rounded", "Sharp"]
OPTICAL_SIZE = ["20", "24", "40", "48"]  # in px
GRAD = ["-25", "0", "200"]
WEIGHT = ['100', '200', '300', '400', '500', '600', '700']
FILL = [1,0]

What does this means:

ii

See More : https://m3.material.io/styles/icons/overview

Why this?

This project exists because not all libraries support variable fonts, such as SDL. It aims to provide a solution for using variable fonts in libraries that do not support them. By converting the variable font to a set of static fonts, this project allows for the use of variable fonts in any library that supports static fonts.

Usage

To use this repository, follow these steps:

  1. Choose your favorite font file and download it. You can use it anywhere.
  2. Type the Unicode character, for example: \ue769

You can find the Unicode character for each icon at https://fonts.google.com/icons.

Here's an example of how the icon would look like with its Unicode character:

Screenshot_20230501_223656

That's it! You can now use any Material Symbol for your projects.

Kivy Example:

from kivy.app import App
from kivy.lang import Builder

UI = Builder.load_string(
"""
Label:
    text:"\ue769"
    font_name:"fonts/Material_Symbols_Rounded-20-100-0_-25.ttf"
    font_size:"300sp"
    halign:"center"
"""
)


class Testapp(App):

    def build(self):
        return UI

Testapp().run()

About

Get all the possible combination of Material Symbols in Truetype format

License:MIT License


Languages

Language:Python 100.0%