Created
October 9, 2024 11:29
-
-
Save Alpha255/9aa8aedbcf4512db1d5d6b2e967ebff6 to your computer and use it in GitHub Desktop.
Blender Icon Font Generate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FontBlender( Font ): # Pictogrammers Material Design Icons | |
| font_name = 'Blender Icons' | |
| font_abbr = 'BLENDER' | |
| font_data_prefix = '.icon-' | |
| font_data = 'C:/Users/lilithgames.LLS-20240418CQX/Downloads/icomoon (1)/style.css' | |
| ttfs = [[ font_abbr, 'icomoon.ttf', 'C:/Users/lilithgames.LLS-20240418CQX/Downloads/icomoon (1)/fonts/icomoon.ttf' ]] | |
| @classmethod | |
| def get_icons( cls, input_data ): | |
| icons_data = {} | |
| fontids = list() | |
| lines = str.split( input_data, '}\n' ) | |
| if lines: | |
| font_min = '0x10ffff' | |
| font_min_int = int( font_min, 16 ) | |
| font_max_16 = '0x0' # 16 bit max | |
| font_max_16_int = int( font_max_16, 16 ) | |
| font_max = '0x0' | |
| font_max_int = int( font_max, 16 ) | |
| icons = [] | |
| for line in lines : | |
| if cls.font_data_prefix in line and ':before' in line: | |
| font_id = line.partition( cls.font_data_prefix )[ 2 ].partition( ':before' )[ 0 ].split(' ')[0] | |
| if font_id in fontids: | |
| continue | |
| fontids.append(font_id) | |
| font_code = line.partition( '"\\' )[ 2 ].partition( '"' )[ 0 ].zfill( 4 ) | |
| font_code_int = int( font_code, 16 ) | |
| if font_code_int < font_min_int and font_code_int > 0x0127 : # exclude ASCII characters code points | |
| font_min = font_code | |
| font_min_int = font_code_int | |
| if font_code_int > font_max_16_int and font_code_int <= 0xffff: # exclude code points > 16 bits | |
| font_max_16 = font_code | |
| font_max_16_int = font_code_int | |
| if font_code_int > font_max_int: | |
| font_max = font_code | |
| font_max_int = font_code_int | |
| icons.append([ font_id, font_code ]) | |
| icons_data.update({ 'font_min' : font_min, | |
| 'font_max_16' : font_max_16, | |
| 'font_max' : font_max, | |
| 'icons' : icons }) | |
| return icons_data | |
| # https://icomoon.io/app | |
| # GenerateIconFontCppHeaders.py ttf2hederC=True | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment