diff --git a/bin/scripts/lib/i_oct.sh b/bin/scripts/lib/i_oct.sh index c890ced108..274f484a68 100644 --- a/bin/scripts/lib/i_oct.sh +++ b/bin/scripts/lib/i_oct.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash -# Octicons (172 icons) -# Codepoints: 2665, 26A1, Nerd Fonts moved F000-F105 with holes → F400-F4A8, F27C → F67C +# Octicons (309 icons) +# Codepoints: 2665-F532 with gaps +# Nerd Fonts Version: 2.3.3 +# Script Version: (autogenerated) test -n "$__i_oct_loaded" && return || __i_oct_loaded=1 i='♥' i_oct_heart=$i i='⚡' i_oct_zap=$i @@ -10,23 +12,23 @@ i='' i_oct_repo_forked=$i i='' i_oct_repo_push=$i i='' i_oct_repo_pull=$i i='' i_oct_book=$i -i='' i_oct_octoface=$i +i='' i_oct_accessibility=$i i='' i_oct_git_pull_request=$i i='' i_oct_mark_github=$i -i='' i_oct_cloud_download=$i -i='' i_oct_cloud_upload=$i -i='' i_oct_keyboard=$i -i='' i_oct_gist=$i +i='' i_oct_download=$i +i='' i_oct_upload=$i +i='' i_oct_accessibility_inset=$i +i='' i_oct_alert_fill=$i i='' i_oct_file_code=$i -i='' i_oct_file_text=$i +i='' i_oct_apps=$i i='' i_oct_file_media=$i i='' i_oct_file_zip=$i -i='' i_oct_file_pdf=$i +i='' i_oct_archive=$i i='' i_oct_tag=$i i='' i_oct_file_directory=$i i='' i_oct_file_submodule=$i i='' i_oct_person=$i -i='' i_oct_jersey=$i +i='' i_oct_arrow_both=$i i='' i_oct_git_commit=$i i='' i_oct_git_branch=$i i='' i_oct_git_merge=$i @@ -40,19 +42,19 @@ i='' i_oct_question=$i i='' i_oct_alert=$i i='' i_oct_search=$i i='' i_oct_gear=$i -i='' i_oct_radio_tower=$i +i='' i_oct_arrow_down_left=$i i='' i_oct_tools=$i i='' i_oct_sign_out=$i i='' i_oct_rocket=$i i='' i_oct_rss=$i -i='' i_oct_clippy=$i +i='' i_oct_paste=$i i='' i_oct_sign_in=$i i='' i_oct_organization=$i i='' i_oct_device_mobile=$i i='' i_oct_unfold=$i i='' i_oct_check=$i i='' i_oct_mail=$i -i='' i_oct_mail_read=$i +i='' i_oct_read=$i i='' i_oct_arrow_up=$i i='' i_oct_arrow_right=$i i='' i_oct_arrow_down=$i @@ -66,14 +68,14 @@ i='' i_oct_clock=$i i='' i_oct_ruby=$i i='' i_oct_broadcast=$i i='' i_oct_key=$i -i='' i_oct_repo_force_push=$i +i='' i_oct_arrow_down_right=$i i='' i_oct_repo_clone=$i i='' i_oct_diff=$i i='' i_oct_eye=$i i='' i_oct_comment_discussion=$i -i='' i_oct_mail_reply=$i -i='' i_oct_primitive_dot=$i -i='' i_oct_primitive_square=$i +i='' i_oct_arrow_switch=$i +i='' i_oct_dot_fill=$i +i='' i_oct_square_fill=$i i='' i_oct_device_camera=$i i='' i_oct_device_camera_video=$i i='' i_oct_pencil=$i @@ -96,14 +98,14 @@ i='' i_oct_diff_removed=$i i='' i_oct_diff_modified=$i i='' i_oct_diff_renamed=$i i='' i_oct_horizontal_rule=$i -i='' i_oct_arrow_small_right=$i +i='' i_oct_arrow_up_left=$i i='' i_oct_milestone=$i i='' i_oct_checklist=$i i='' i_oct_megaphone=$i i='' i_oct_chevron_right=$i i='' i_oct_bookmark=$i -i='' i_oct_settings=$i -i='' i_oct_dashboard=$i +i='' i_oct_sliders=$i +i='' i_oct_meter=$i i='' i_oct_history=$i i='' i_oct_link_external=$i i='' i_oct_mute=$i @@ -112,7 +114,7 @@ i='' i_oct_circle_slash=$i i='' i_oct_pulse=$i i='' i_oct_sync=$i i='' i_oct_telescope=$i -i='' i_oct_gist_secret=$i +i='' i_oct_arrow_up_right=$i i='' i_oct_home=$i i='' i_oct_stop=$i i='' i_oct_bug=$i @@ -122,11 +124,11 @@ i='' i_oct_database=$i i='' i_oct_server=$i i='' i_oct_diff_ignored=$i i='' i_oct_ellipsis=$i -i='' i_oct_no_newline=$i +i='' i_oct_bell_fill=$i i='' i_oct_hubot=$i -i='' i_oct_arrow_small_up=$i -i='' i_oct_arrow_small_down=$i -i='' i_oct_arrow_small_left=$i +i='' i_oct_bell_slash=$i +i='' i_oct_blocked=$i +i='' i_oct_bookmark_fill=$i i='' i_oct_chevron_up=$i i='' i_oct_chevron_down=$i i='' i_oct_chevron_left=$i @@ -134,7 +136,7 @@ i='' i_oct_triangle_up=$i i='' i_oct_git_compare=$i i='' i_oct_logo_gist=$i i='' i_oct_file_symlink_file=$i -i='' i_oct_file_symlink_directory=$i +i='' i_oct_bookmark_slash=$i i='' i_oct_squirrel=$i i='' i_oct_globe=$i i='' i_oct_unmute=$i @@ -146,12 +148,12 @@ i='' i_oct_markdown=$i i='' i_oct_dash=$i i='' i_oct_fold=$i i='' i_oct_inbox=$i -i='' i_oct_trashcan=$i -i='' i_oct_paintcan=$i +i='' i_oct_trash=$i +i='' i_oct_paintbrush=$i i='' i_oct_flame=$i i='' i_oct_briefcase=$i i='' i_oct_plug=$i -i='' i_oct_circuit_board=$i +i='' i_oct_bookmark_slash_fill=$i i='' i_oct_mortar_board=$i i='' i_oct_law=$i i='' i_oct_thumbsup=$i @@ -159,19 +161,156 @@ i='' i_oct_thumbsdown=$i i='' i_oct_desktop_download=$i i='' i_oct_beaker=$i i='' i_oct_bell=$i -i='' i_oct_watch=$i +i='' i_oct_cache=$i i='' i_oct_shield=$i i='' i_oct_bold=$i -i='' i_oct_text_size=$i +i='' i_oct_check_circle=$i i='' i_oct_italic=$i i='' i_oct_tasklist=$i i='' i_oct_verified=$i i='' i_oct_smiley=$i i='' i_oct_unverified=$i -i='' i_oct_ellipses=$i +i='' i_oct_check_circle_fill=$i i='' i_oct_file=$i i='' i_oct_grabber=$i -i='' i_oct_plus_small=$i +i='' i_oct_checkbox=$i i='' i_oct_reply=$i i='' i_oct_device_desktop=$i +i='' i_oct_circle=$i +i='' i_oct_clock_fill=$i +i='' i_oct_cloud=$i +i='' i_oct_cloud_offline=$i +i='' i_oct_code_of_conduct=$i +i='' i_oct_code_review=$i +i='' i_oct_code_square=$i +i='' i_oct_codescan=$i +i='' i_oct_codescan_checkmark=$i +i='' i_oct_codespaces=$i +i='' i_oct_columns=$i +i='' i_oct_command_palette=$i +i='' i_oct_commit=$i +i='' i_oct_container=$i +i='' i_oct_copilot=$i +i='' i_oct_copilot_error=$i +i='' i_oct_copilot_warning=$i +i='' i_oct_copy=$i +i='' i_oct_cpu=$i +i='' i_oct_cross_reference=$i +i='' i_oct_dependabot=$i +i='' i_oct_diamond=$i +i='' i_oct_discussion_closed=$i +i='' i_oct_discussion_duplicate=$i +i='' i_oct_discussion_outdated=$i +i='' i_oct_dot=$i +i='' i_oct_duplicate=$i +i='' i_oct_eye_closed=$i +i='' i_oct_feed_discussion=$i +i='' i_oct_feed_forked=$i +i='' i_oct_feed_heart=$i +i='' i_oct_feed_merged=$i +i='' i_oct_feed_person=$i +i='' i_oct_feed_repo=$i +i='' i_oct_feed_rocket=$i +i='' i_oct_feed_star=$i +i='' i_oct_feed_tag=$i +i='' i_oct_feed_trophy=$i +i='' i_oct_file_added=$i +i='' i_oct_file_badge=$i +i='' i_oct_file_diff=$i +i='' i_oct_file_directory_fill=$i +i='' i_oct_file_directory_open_fill=$i +i='' i_oct_file_moved=$i +i='' i_oct_file_removed=$i +i='' i_oct_filter=$i +i='' i_oct_fiscal_host=$i +i='' i_oct_fold_down=$i +i='' i_oct_fold_up=$i +i='' i_oct_git_merge_queue=$i +i='' i_oct_git_pull_request_closed=$i +i='' i_oct_git_pull_request_draft=$i +i='' i_oct_goal=$i +i='' i_oct_hash=$i +i='' i_oct_heading=$i +i='' i_oct_heart_fill=$i +i='' i_oct_home_fill=$i +i='' i_oct_hourglass=$i +i='' i_oct_id_badge=$i +i='' i_oct_image=$i +i='' i_oct_infinity=$i +i='' i_oct_issue_draft=$i +i='' i_oct_issue_tracked_by=$i +i='' i_oct_issue_tracks=$i +i='' i_oct_iterations=$i +i='' i_oct_kebab_horizontal=$i +i='' i_oct_key_asterisk=$i +i='' i_oct_log=$i +i='' i_oct_moon=$i +i='' i_oct_move_to_bottom=$i +i='' i_oct_move_to_end=$i +i='' i_oct_move_to_start=$i +i='' i_oct_move_to_top=$i +i='' i_oct_multi_select=$i +i='' i_oct_no_entry=$i +i='' i_oct_north_star=$i +i='' i_oct_note=$i +i='' i_oct_number=$i +i='' i_oct_package_dependencies=$i +i='' i_oct_package_dependents=$i +i='' i_oct_paper_airplane=$i +i='' i_oct_paperclip=$i +i='' i_oct_passkey_fill=$i +i='' i_oct_people=$i +i='' i_oct_person_add=$i +i='' i_oct_person_fill=$i +i='' i_oct_play=$i +i='' i_oct_plus_circle=$i +i='' i_oct_project=$i +i='' i_oct_project_roadmap=$i +i='' i_oct_project_symlink=$i +i='' i_oct_project_template=$i +i='' i_oct_rel_file_path=$i +i='' i_oct_repo_deleted=$i +i='' i_oct_repo_locked=$i +i='' i_oct_repo_template=$i +i='' i_oct_report=$i +i='' i_oct_rows=$i +i='' i_oct_screen_full=$i +i='' i_oct_screen_normal=$i +i='' i_oct_share=$i +i='' i_oct_share_android=$i +i='' i_oct_shield_check=$i +i='' i_oct_shield_lock=$i +i='' i_oct_shield_slash=$i +i='' i_oct_shield_x=$i +i='' i_oct_sidebar_collapse=$i +i='' i_oct_sidebar_expand=$i +i='' i_oct_single_select=$i +i='' i_oct_skip=$i +i='' i_oct_skip_fill=$i +i='' i_oct_sort_asc=$i +i='' i_oct_sort_desc=$i +i='' i_oct_sparkle_fill=$i +i='' i_oct_sponsor_tiers=$i +i='' i_oct_square=$i +i='' i_oct_stack=$i +i='' i_oct_star_fill=$i +i='' i_oct_stopwatch=$i +i='' i_oct_strikethrough=$i +i='' i_oct_sun=$i +i='' i_oct_tab=$i +i='' i_oct_tab_external=$i +i='' i_oct_table=$i +i='' i_oct_telescope_fill=$i +i='' i_oct_trophy=$i +i='' i_oct_typography=$i +i='' i_oct_unlink=$i +i='' i_oct_unlock=$i +i='' i_oct_unread=$i +i='' i_oct_video=$i +i='' i_oct_webhook=$i +i='' i_oct_workflow=$i +i='' i_oct_x_circle=$i +i='' i_oct_x_circle_fill=$i +i='' i_oct_zoom_in=$i +i='' i_oct_zoom_out=$i unset i diff --git a/font-patcher b/font-patcher index b876540fa3..fb6b7dddae 100755 --- a/font-patcher +++ b/font-patcher @@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals # Change the script version when you edit this script: -script_version = "4.0.0" +script_version = "4.1.0" version = "2.3.3" projectName = "Nerd Fonts" @@ -1027,14 +1027,14 @@ class font_patcher: {'Enabled': self.args.fontawesomeextension, 'Name': "Font Awesome Extension", 'Filename': "font-awesome-extension.ttf", 'Exact': False, 'SymStart': 0xE000, 'SymEnd': 0xE0A9, 'SrcStart': 0xE200, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, # Maximize {'Enabled': self.args.powersymbols, 'Name': "Power Symbols", 'Filename': "Unicode_IEC_symbol_font.otf", 'Exact': True, 'SymStart': 0x23FB, 'SymEnd': 0x23FE, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, # Power, Power On/Off, Power On, Sleep {'Enabled': self.args.powersymbols, 'Name': "Power Symbols", 'Filename': "Unicode_IEC_symbol_font.otf", 'Exact': True, 'SymStart': 0x2B58, 'SymEnd': 0x2B58, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, # Heavy Circle (aka Power Off) - {'Enabled': self.args.material, 'Name': "Material legacy", 'Filename': "materialdesignicons-webfont.ttf", 'Exact': False, 'SymStart': 0xF001, 'SymEnd': 0xF847, 'SrcStart': 0xF500, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, + {'Enabled': False , 'Name': "Material legacy", 'Filename': "materialdesignicons-webfont.ttf", 'Exact': False, 'SymStart': 0xF001, 'SymEnd': 0xF847, 'SrcStart': 0xF500, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.material, 'Name': "Material", 'Filename': "materialdesign/MaterialDesignIconsDesktop.ttf", 'Exact': True, 'SymStart': 0xF0001,'SymEnd': 0xF1AF0,'SrcStart': None, 'ScaleRules': MDI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.weather, 'Name': "Weather Icons", 'Filename': "weather-icons/weathericons-regular-webfont.ttf", 'Exact': False, 'SymStart': 0xF000, 'SymEnd': 0xF0EB, 'SrcStart': 0xE300, 'ScaleRules': WEATH_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.fontlogos, 'Name': "Font Logos", 'Filename': "font-logos.ttf", 'Exact': True, 'SymStart': 0xF300, 'SymEnd': 0xF32F, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, - {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons.ttf", 'Exact': False, 'SymStart': 0xF000, 'SymEnd': 0xF105, 'SrcStart': 0xF400, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Magnifying glass - {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons.ttf", 'Exact': True, 'SymStart': 0x2665, 'SymEnd': 0x2665, 'SrcStart': None, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Heart - {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons.ttf", 'Exact': True, 'SymStart': 0X26A1, 'SymEnd': 0X26A1, 'SrcStart': None, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Zap - {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons.ttf", 'Exact': False, 'SymStart': 0xF27C, 'SymEnd': 0xF27C, 'SrcStart': 0xF4A9, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Desktop + {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons/octicons.ttf", 'Exact': False, 'SymStart': 0xF000, 'SymEnd': 0xF105, 'SrcStart': 0xF400, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Magnifying glass + {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons/octicons.ttf", 'Exact': True, 'SymStart': 0x2665, 'SymEnd': 0x2665, 'SrcStart': None, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Heart + {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons/octicons.ttf", 'Exact': True, 'SymStart': 0X26A1, 'SymEnd': 0X26A1, 'SrcStart': None, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Zap + {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons/octicons.ttf", 'Exact': False, 'SymStart': 0xF27C, 'SymEnd': 0xF305, 'SrcStart': 0xF4A9, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.codicons, 'Name': "Codicons", 'Filename': "codicons/codicon.ttf", 'Exact': True, 'SymStart': 0xEA60, 'SymEnd': 0xEBEB, 'SrcStart': None, 'ScaleRules': CODI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.custom, 'Name': "Custom", 'Filename': self.args.custom, 'Exact': True, 'SymStart': 0x0000, 'SymEnd': 0x0000, 'SrcStart': None, 'ScaleRules': None, 'Attributes': CUSTOM_ATTR} ] diff --git a/src/glyphs/octicons.ttf b/src/glyphs/octicons.ttf deleted file mode 100644 index ff0dda1847..0000000000 Binary files a/src/glyphs/octicons.ttf and /dev/null differ diff --git a/src/glyphs/octicons/LICENSE b/src/glyphs/octicons/LICENSE new file mode 100644 index 0000000000..163074d5b4 --- /dev/null +++ b/src/glyphs/octicons/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/glyphs/octicons/analyze_octicons b/src/glyphs/octicons/analyze_octicons new file mode 100755 index 0000000000..35fa961d11 --- /dev/null +++ b/src/glyphs/octicons/analyze_octicons @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# coding=utf8 + +# This extracts the names and source and destination codepoints +# of the old octicons font file to keep their codepoints stable +# +# You do not need to redo it, the result is in the repo +# +# Usage: +# fontforge analyze_octicons > mapping + +import fontforge + +octi_orig = "octicons.ttf" +current_cp = 0xF400 + +print('# Examining {}'.format(octi_orig)) + +font = fontforge.open(octi_orig) +for glyph in font.glyphs('encoding'): + point = glyph.unicode + if point < 0: + continue + desti = glyph.unicode + if point < 0xF000: + desti = point + else: + desti = current_cp + current_cp += 1 + print("{:X} {:X} {}".format(point, desti, glyph.glyphname)) + +font.close() diff --git a/src/glyphs/octicons/generate b/src/glyphs/octicons/generate new file mode 100755 index 0000000000..b9e7722133 --- /dev/null +++ b/src/glyphs/octicons/generate @@ -0,0 +1,180 @@ +#!/usr/bin/env python3 +# coding=utf8 + +import sys +import os +import re +import subprocess +import fontforge + +# Double-quotes required here, for version-bump.sh: +version = "2.3.3" + +archive = 'v18.3.0.tar.gz' + +vectorsdir = 'icons' +fontdir = '.' +fontfile = 'octicons.ttf' +glyphsetfile = 'i_oct.sh' +glyphsetsdir = '../../../bin/scripts/lib' + +subset = '-16' # use 16 px subset if possible +subset_other = '-24' # use 24 px subset otherwise + +def renamer(old_name): + """ Return new equivalent icon name """ + return { + 'trashcan' : 'trash', + 'cloud-download' : 'download', + 'cloud-upload' : 'upload', + 'clippy' : 'paste', + 'mail-read' : 'read', + 'primitive-dot' : 'dot-fill', + 'primitive-square' : 'square-fill', + 'settings' : 'sliders', + 'dashboard' : 'meter', + 'paintcan' : 'paintbrush', + }.get(old_name, old_name) + +def addIcon(codepoint, name, filename): + """ Add one outline file and rescale/move """ + dBB = [120, 0, 1000-120, 900] # just some nice sizes + filename = os.path.join(vectorsdir, filename) + glyph = font.createChar(codepoint, name) + glyph.importOutlines(filename) + glyph.manualHints = True + +def createGlyphInfo(icon_datasets, filepathname, into): + """ Write the glyphinfo file """ + with open(filepathname, 'w', encoding = 'utf8') as f: + f.write(u'#!/usr/bin/env bash\n') + f.write(intro) + f.write(u'# Script Version: (autogenerated)\n') + f.write(u'test -n "$__i_oct_loaded" && return || __i_oct_loaded=1\n') + for _, codepoint, name in icon_datasets: + codepoint = int(codepoint, 16) + f.write(u"i='{}' i_oct_{}=$i\n".format(chr(codepoint), name.replace('-', '_'))) + f.write(u'unset i\n') + +print('\nReading mapping file') +old_mapping = [] +with open('mapping', 'r') as f: + for line in f.readlines(): + if line.startswith('#'): + continue + old_mapping.append(tuple(re.split(' +', line.strip()))) +print('Found {} entries'.format(len(old_mapping))) +old_mapping.sort(key=(lambda x: x[0])) + +print('Fetching octicons archive "{}"\n'.format(archive)) +if subprocess.call('curl -OL https://github.com/primer/octicons/archive/' + archive, shell=True): + sys.exit('Error fetching octicons archive') +print('\nUnpacking octicons archive') +if subprocess.call('rm -rf icons octicons-* && tar zxf *.gz && mv octicons-*/icons . && rm -rf octicons-*', shell=True): + sys.exit('Error unpacking archive') + +svgs = os.listdir(vectorsdir) +print('Found {} svgs'.format(len(svgs))) +names = { s[0:-len('-xx.svg')] for s in svgs if s.endswith(subset + '.svg') or s.endswith(subset_other + '.svg') } +print('Found {} icons after de-duplicating\n'.format(len(names))) + +num_found = 0 +num_missing = 0 +misslist = '' +renamelist = '' +freeslots = [] + +new_mapping = [] +for i, j, old_n in old_mapping: + if old_n in names: + names.remove(old_n) + new_mapping.append((i, j, old_n)) + num_found += 1 + continue + new_n = renamer(old_n) + if new_n in names: + renamelist += 'Renamed {} -> {}\n'.format(old_n, new_n) + names.remove(new_n) + new_mapping.append((i, j, new_n)) + num_found += 1 + continue + misslist += 'Missing {}\n'.format(old_n) + freeslots.append((i, j)) + num_missing += 1 + +print(renamelist) +print(misslist) +print('Found {} (of {}, missing {}) and new {}'.format(num_found, len(old_mapping), num_missing, len(names))) + +names = list(names) +names.sort() +for n in list(names): + if len(freeslots) == 0: + break + i, j = freeslots[0] + new_mapping.append((i, j, n)) + names.remove(n) + freeslots = freeslots[1:] + +print('Filled in missing, remaining new {}'.format(len(names))) + +i_max = 0 +j_max = 0 +for i, j, _ in new_mapping: + i = int(i, 16) + j = int(j, 16) + if i > i_max: + i_max = i + if j > j_max: + j_max = j + +for n in names: + i_max += 1 + j_max += 1 + new_mapping.append(('{:X}'.format(i_max), '{:X}'.format(j_max), n)) + +print('Appended remaining new, total new mapping {}'.format(len(new_mapping))) + +new_mapping.sort(key=(lambda x: x[0])) +with open('mapping', 'w') as f: + for i, j, n in new_mapping: + f.write('{} {} {}\n'.format(i, j, n)) + +font = fontforge.font() +font.fontname = 'OcticonsNerdFont-Regular' +font.fullname = 'Octicons Nerd Font Regular' +font.familyname = 'Octicons Nerd Font' +font.em = 2048 +font.encoding = 'UnicodeFull' + +# Add valid space glyph to avoid "unknown character" box on IE11 +glyph = font.createChar(32) +glyph.width = 200 + +font.sfntRevision = None # Auto-set (refreshed) by fontforge +font.version = version +font.copyright = 'GitHub Inc.' +font.appendSFNTName('English (US)', 'Version', archive + '; ' + version) +font.appendSFNTName('English (US)', 'Vendor URL', 'https://github.com/ryanoasis/nerd-fonts') +font.appendSFNTName('English (US)', 'Copyright', 'GitHub Inc.') + +for codepoint, _, name in new_mapping: + codepoint = int(codepoint, 16) + filename = name + subset + '.svg' + if filename not in svgs: + filename = name + subset_other + '.svg' + addIcon(codepoint, name, filename) + +num_icons = len(new_mapping) + +print('Generating {} with {} glyphs'.format(fontfile, num_icons)) +font.generate(os.path.join(fontdir, fontfile), flags=("no-FFTM-table",)) + +codepoints = [ int(p, 16) for _, p, _ in new_mapping ] +intro = u'# Octicons ({} icons)\n'.format(num_icons) +intro += u'# Codepoints: {:X}-{:X} with gaps\n'.format(min(codepoints), max(codepoints)) +intro += u'# Nerd Fonts Version: {}\n'.format(version) + +print('Generating GlyphInfo {}'.format(glyphsetfile)) +createGlyphInfo(new_mapping, os.path.join(glyphsetsdir, glyphsetfile), intro) +print('Finished') diff --git a/src/glyphs/octicons/mapping b/src/glyphs/octicons/mapping new file mode 100644 index 0000000000..880fca02a1 --- /dev/null +++ b/src/glyphs/octicons/mapping @@ -0,0 +1,309 @@ +2665 2665 heart +26A1 26A1 zap +F000 F400 light-bulb +F001 F401 repo +F002 F402 repo-forked +F005 F403 repo-push +F006 F404 repo-pull +F007 F405 book +F008 F406 accessibility +F009 F407 git-pull-request +F00A F408 mark-github +F00B F409 download +F00C F40A upload +F00D F40B accessibility-inset +F00E F40C alert-fill +F010 F40D file-code +F011 F40E apps +F012 F40F file-media +F013 F410 file-zip +F014 F411 archive +F015 F412 tag +F016 F413 file-directory +F017 F414 file-submodule +F018 F415 person +F019 F416 arrow-both +F01F F417 git-commit +F020 F418 git-branch +F023 F419 git-merge +F024 F41A mirror +F026 F41B issue-opened +F027 F41C issue-reopened +F028 F41D issue-closed +F02A F41E star +F02B F41F comment +F02C F420 question +F02D F421 alert +F02E F422 search +F02F F423 gear +F030 F424 arrow-down-left +F031 F425 tools +F032 F426 sign-out +F033 F427 rocket +F034 F428 rss +F035 F429 paste +F036 F42A sign-in +F037 F42B organization +F038 F42C device-mobile +F039 F42D unfold +F03A F42E check +F03B F42F mail +F03C F430 read +F03D F431 arrow-up +F03E F432 arrow-right +F03F F433 arrow-down +F040 F434 arrow-left +F041 F435 pin +F042 F436 gift +F043 F437 graph +F044 F438 triangle-left +F045 F439 credit-card +F046 F43A clock +F047 F43B ruby +F048 F43C broadcast +F049 F43D key +F04A F43E arrow-down-right +F04C F43F repo-clone +F04D F440 diff +F04E F441 eye +F04F F442 comment-discussion +F051 F443 arrow-switch +F052 F444 dot-fill +F053 F445 square-fill +F056 F446 device-camera +F057 F447 device-camera-video +F058 F448 pencil +F059 F449 info +F05A F44A triangle-right +F05B F44B triangle-down +F05C F44C link +F05D F44D plus +F05E F44E three-bars +F05F F44F code +F060 F450 location +F061 F451 list-unordered +F062 F452 list-ordered +F063 F453 quote +F064 F454 versions +F068 F455 calendar +F06A F456 lock +F06B F457 diff-added +F06C F458 diff-removed +F06D F459 diff-modified +F06E F45A diff-renamed +F070 F45B horizontal-rule +F071 F45C arrow-up-left +F075 F45D milestone +F076 F45E checklist +F077 F45F megaphone +F078 F460 chevron-right +F07B F461 bookmark +F07C F462 sliders +F07D F463 meter +F07E F464 history +F07F F465 link-external +F080 F466 mute +F081 F467 x +F084 F468 circle-slash +F085 F469 pulse +F087 F46A sync +F088 F46B telescope +F08C F46C arrow-up-right +F08D F46D home +F08F F46E stop +F091 F46F bug +F092 F470 logo-github +F094 F471 file-binary +F096 F472 database +F097 F473 server +F099 F474 diff-ignored +F09A F475 ellipsis +F09C F476 bell-fill +F09D F477 hubot +F09F F478 bell-slash +F0A0 F479 blocked +F0A1 F47A bookmark-fill +F0A2 F47B chevron-up +F0A3 F47C chevron-down +F0A4 F47D chevron-left +F0AA F47E triangle-up +F0AC F47F git-compare +F0AD F480 logo-gist +F0B0 F481 file-symlink-file +F0B1 F482 bookmark-slash +F0B2 F483 squirrel +F0B6 F484 globe +F0BA F485 unmute +F0BE F486 mention +F0C4 F487 package +F0C5 F488 browser +F0C8 F489 terminal +F0C9 F48A markdown +F0CA F48B dash +F0CC F48C fold +F0CF F48D inbox +F0D0 F48E trash +F0D1 F48F paintbrush +F0D2 F490 flame +F0D3 F491 briefcase +F0D4 F492 plug +F0D6 F493 bookmark-slash-fill +F0D7 F494 mortar-board +F0D8 F495 law +F0DA F496 thumbsup +F0DB F497 thumbsdown +F0DC F498 desktop-download +F0DD F499 beaker +F0DE F49A bell +F0E0 F49B cache +F0E1 F49C shield +F0E2 F49D bold +F0E3 F49E check-circle +F0E4 F49F italic +F0E5 F4A0 tasklist +F0E6 F4A1 verified +F0E7 F4A2 smiley +F0E8 F4A3 unverified +F101 F4A4 check-circle-fill +F102 F4A5 file +F103 F4A6 grabber +F104 F4A7 checkbox +F105 F4A8 reply +F27C F4A9 device-desktop +F27D F4AA circle +F27E F4AB clock-fill +F27F F4AC cloud +F280 F4AD cloud-offline +F281 F4AE code-of-conduct +F282 F4AF code-review +F283 F4B0 code-square +F284 F4B1 codescan +F285 F4B2 codescan-checkmark +F286 F4B3 codespaces +F287 F4B4 columns +F288 F4B5 command-palette +F289 F4B6 commit +F28A F4B7 container +F28B F4B8 copilot +F28C F4B9 copilot-error +F28D F4BA copilot-warning +F28E F4BB copy +F28F F4BC cpu +F290 F4BD cross-reference +F291 F4BE dependabot +F292 F4BF diamond +F293 F4C0 discussion-closed +F294 F4C1 discussion-duplicate +F295 F4C2 discussion-outdated +F296 F4C3 dot +F297 F4C4 duplicate +F298 F4C5 eye-closed +F299 F4C6 feed-discussion +F29A F4C7 feed-forked +F29B F4C8 feed-heart +F29C F4C9 feed-merged +F29D F4CA feed-person +F29E F4CB feed-repo +F29F F4CC feed-rocket +F2A0 F4CD feed-star +F2A1 F4CE feed-tag +F2A2 F4CF feed-trophy +F2A3 F4D0 file-added +F2A4 F4D1 file-badge +F2A5 F4D2 file-diff +F2A6 F4D3 file-directory-fill +F2A7 F4D4 file-directory-open-fill +F2A8 F4D5 file-moved +F2A9 F4D6 file-removed +F2AA F4D7 filter +F2AB F4D8 fiscal-host +F2AC F4D9 fold-down +F2AD F4DA fold-up +F2AE F4DB git-merge-queue +F2AF F4DC git-pull-request-closed +F2B0 F4DD git-pull-request-draft +F2B1 F4DE goal +F2B2 F4DF hash +F2B3 F4E0 heading +F2B4 F4E1 heart-fill +F2B5 F4E2 home-fill +F2B6 F4E3 hourglass +F2B7 F4E4 id-badge +F2B8 F4E5 image +F2B9 F4E6 infinity +F2BA F4E7 issue-draft +F2BB F4E8 issue-tracked-by +F2BC F4E9 issue-tracks +F2BD F4EA iterations +F2BE F4EB kebab-horizontal +F2BF F4EC key-asterisk +F2C0 F4ED log +F2C1 F4EE moon +F2C2 F4EF move-to-bottom +F2C3 F4F0 move-to-end +F2C4 F4F1 move-to-start +F2C5 F4F2 move-to-top +F2C6 F4F3 multi-select +F2C7 F4F4 no-entry +F2C8 F4F5 north-star +F2C9 F4F6 note +F2CA F4F7 number +F2CB F4F8 package-dependencies +F2CC F4F9 package-dependents +F2CD F4FA paper-airplane +F2CE F4FB paperclip +F2CF F4FC passkey-fill +F2D0 F4FD people +F2D1 F4FE person-add +F2D2 F4FF person-fill +F2D3 F500 play +F2D4 F501 plus-circle +F2D5 F502 project +F2D6 F503 project-roadmap +F2D7 F504 project-symlink +F2D8 F505 project-template +F2D9 F506 rel-file-path +F2DA F507 repo-deleted +F2DB F508 repo-locked +F2DC F509 repo-template +F2DD F50A report +F2DE F50B rows +F2DF F50C screen-full +F2E0 F50D screen-normal +F2E1 F50E share +F2E2 F50F share-android +F2E3 F510 shield-check +F2E4 F511 shield-lock +F2E5 F512 shield-slash +F2E6 F513 shield-x +F2E7 F514 sidebar-collapse +F2E8 F515 sidebar-expand +F2E9 F516 single-select +F2EA F517 skip +F2EB F518 skip-fill +F2EC F519 sort-asc +F2ED F51A sort-desc +F2EE F51B sparkle-fill +F2EF F51C sponsor-tiers +F2F0 F51D square +F2F1 F51E stack +F2F2 F51F star-fill +F2F3 F520 stopwatch +F2F4 F521 strikethrough +F2F5 F522 sun +F2F6 F523 tab +F2F7 F524 tab-external +F2F8 F525 table +F2F9 F526 telescope-fill +F2FA F527 trophy +F2FB F528 typography +F2FC F529 unlink +F2FD F52A unlock +F2FE F52B unread +F2FF F52C video +F300 F52D webhook +F301 F52E workflow +F302 F52F x-circle +F303 F530 x-circle-fill +F304 F531 zoom-in +F305 F532 zoom-out diff --git a/src/glyphs/octicons/octicons.ttf b/src/glyphs/octicons/octicons.ttf new file mode 100644 index 0000000000..f864314465 Binary files /dev/null and b/src/glyphs/octicons/octicons.ttf differ