mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge pull request #1307 from ynput/Update-qtmaterialsymbols-to-a-more-recent-font-version
Update Material Symbols to the latest version, add function to re-generate json file.
This commit is contained in:
commit
92d5859556
5 changed files with 635 additions and 11 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
BIN
client/ayon_core/vendor/python/qtmaterialsymbols/resources/MaterialSymbolsOutlined-Regular.ttf
vendored
Normal file
BIN
client/ayon_core/vendor/python/qtmaterialsymbols/resources/MaterialSymbolsOutlined-Regular.ttf
vendored
Normal file
Binary file not shown.
Binary file not shown.
|
|
@ -5,12 +5,32 @@ CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|||
|
||||
|
||||
def get_font_filepath(
|
||||
font_name: Optional[str] = "MaterialSymbolsOutlined"
|
||||
font_name: Optional[str] = "MaterialSymbolsOutlined-Regular"
|
||||
) -> str:
|
||||
return os.path.join(CURRENT_DIR, f"{font_name}.ttf")
|
||||
|
||||
|
||||
def get_mapping_filepath(
|
||||
font_name: Optional[str] = "MaterialSymbolsOutlined"
|
||||
font_name: Optional[str] = "MaterialSymbolsOutlined-Regular"
|
||||
) -> str:
|
||||
return os.path.join(CURRENT_DIR, f"{font_name}.json")
|
||||
|
||||
|
||||
def regenerate_mapping():
|
||||
"""Regenerate the MaterialSymbolsOutlined.json file, assuming
|
||||
MaterialSymbolsOutlined.codepoints and the TrueType font file have been
|
||||
updated to support the new symbols.
|
||||
"""
|
||||
import json
|
||||
jfile = get_mapping_filepath()
|
||||
cpfile = jfile.replace(".json", ".codepoints")
|
||||
with open(cpfile, "r") as cpf:
|
||||
codepoints = cpf.read()
|
||||
|
||||
mapping = {}
|
||||
for cp in codepoints.splitlines():
|
||||
name, code = cp.split()
|
||||
mapping[name] = int(f"0x{code}", 16)
|
||||
|
||||
with open(jfile, "w") as jf:
|
||||
json.dump(mapping, jf, indent=4)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue