├── .gitignore ├── Argon as SFMono v1.200.zip ├── ArgonHan.zip ├── Aurulent patched.zip ├── CommitMono pateched.zip ├── Consolas patched.zip ├── FiraCode redesign dehinted.zip ├── Lilex patched.zip ├── README.md ├── SourceCodePro.zip ├── fontname.py ├── screenshots ├── aurulent.png ├── firacode.png ├── scp.png └── screenshot_url └── update /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | __MACOSX 4 | -------------------------------------------------------------------------------- /Argon as SFMono v1.200.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/Argon as SFMono v1.200.zip -------------------------------------------------------------------------------- /ArgonHan.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/ArgonHan.zip -------------------------------------------------------------------------------- /Aurulent patched.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/Aurulent patched.zip -------------------------------------------------------------------------------- /CommitMono pateched.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/CommitMono pateched.zip -------------------------------------------------------------------------------- /Consolas patched.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/Consolas patched.zip -------------------------------------------------------------------------------- /FiraCode redesign dehinted.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/FiraCode redesign dehinted.zip -------------------------------------------------------------------------------- /Lilex patched.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/Lilex patched.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > Buy a 4K+ resolution monitor to overcome your programming font addiction, and get the fucking job done! 2 | 3 | ### Screenshots 4 | Fira Code 5 | ![FiraCode](screenshots/firacode.png) 6 | Aurulent 7 | ![Aurulent](screenshots/aurulent.png) 8 | Source Code Pro 9 | ![SourceCodePro](screenshots/scp.png) 10 | 11 | ### Best fonts for programming 12 | 1. Aurulent: It looks like it was written by an artisan pen, add missing glyphs from fira code, my favorite. 13 | 2. Source Code Pro: Simple and crisp, optimized the 0 1 4 r i l glyphs, make it applies to both prose and coding. 14 | 3. Fira Code: [Most popular coding font](https://github.com/tonsky/FiraCode), add some powerline glyphs and redesigned the r glyph. 15 | 4. 聚珍新仿: 搭配上面的Source Code Pro的中文字体,适用于注释, 也适合电子书阅读. 16 | 5. 字语青梅硬笔: 手写中文字体,适用于excalidraw手画风格的架构图. 17 | 6. ArgonHan: Monaspace Argon with chinese glyphs from 聚珍新仿, see more on [支持中文的等宽编程字体-ArgonHan](https://zhi.moe/post/programming-font-han/) 18 | 7. Monaspace Argon: programming font from [GitHub Next Labs](https://monaspace.githubnext.com/#learn-more), the best! 19 | 20 | ### Tips: 21 | 1. you can rename the family name by [fontname.py](https://github.com/chrissimpkins/fontname.py): 22 | ```bash 23 | python fontname.py "Monaspace" MonaspaceArgon-Regular.ttf 24 | ``` 25 | 26 | 2. for non-4K monitor, you need hint the truetype font: 27 | ```bash 28 | sudo apt install ttfautohint 29 | for f in ./*.ttf; do ttfautohint ${f} out/${f} --stem-width-mode qqq --composites ;done 30 | ``` 31 | 32 | 3. patch powerline for your font: 33 | ```bash 34 | docker run --rm -v ./:/in:Z -v ./patched:/out:Z nerdfonts/patcher --use-single-width-glyphs --boxdrawing --powerline --powerlineextra 35 | ``` 36 | 37 | 4. 中英文合并的字体中文间距很大的问题解决方案 38 | ```python 39 | from fontTools.ttLib import TTFont 40 | font = TTFont('C:\\Documents\\YaHei.ttf') 41 | 42 | # xAvgCharWidth只能脚本设置,fontforge计算的不对 43 | # 设置成中文字符宽度的1/2,否则部分windows软件(字体预览、notepad)中文间距很大 44 | font['OS/2'].xAvgCharWidth = 500 45 | # 下面两个在fontforge也可以设置,设置后terminal可以识别成等宽字体 46 | font['OS/2'].panose.bProportion = 9 # 9表示monospaced,0表示any 47 | font['OS/2'].panose.bFamilyType = 2 # 2表示Latin: Text and Display 48 | font.save('C:\\Documents\\YaHei-R.ttf') 49 | # 注意,大部分terminal展示非ascii字符的宽度是ascii字符*2, 50 | # 由于FangSongCode的ASCII字符是600,所以会用1200宽度展示中文字符,导致看着间距很大并且不是居中 51 | # 目前无解,只能选用中英2:1的字体中文才能正常展示,Yahei:Consolas=1000:550,间距看着会正常一点 52 | ``` 53 | 54 | -------------------------------------------------------------------------------- /SourceCodePro.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/SourceCodePro.zip -------------------------------------------------------------------------------- /fontname.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | from fontTools import ttLib 5 | 6 | def main(argv): 7 | # command argument tests 8 | if len(argv) < 2: 9 | exit_with_error_msg(f""" 10 | [fontname.py] ERROR: you did not include enough arguments to the script." 11 | Usage: python3 fontname.py [NEW FAMILY NAME] [FONT PATH 1] " 12 | """) 13 | try: 14 | new_family_name = str(argv[0]) # the first argument is the new typeface name 15 | except Exception as e: 16 | exit_with_error_msg(f"[fontname.py] ERROR: unable to convert argument 1 to string.") 17 | 18 | # all remaining arguments on command line are file paths to fonts 19 | font_path_list = argv[1:] 20 | 21 | # iterate through all paths provided on command line and rename to `new_font_name` defined by user 22 | for font_path in font_path_list: 23 | if not file_exists(font_path): 24 | exit_with_error_msg(f"[fontname.py] ERROR: the path '{font_path}' does not appear to be a valid file path.") 25 | 26 | tt = ttLib.TTFont(font_path) 27 | name_records = tt["name"].names 28 | # ------------------ 29 | style = get_font_style(font_path, name_records) 30 | 31 | """ 32 | PlatformID == 1 33 | NameRecord.nameID | String ID 34 | record.nameID==0 Copyright 35 | record.nameID==1 Family 36 | record.nameID==2 Styles(SubFamily): Regular/Bold/Italic/Bold Italic 37 | record.nameID==3 UniqueID 38 | record.nameID==4 Fullname: {family} {style} 39 | record.nameID==5 Version 40 | record.nameID==6 Postscript Fullname: {family no space}-{style} 41 | record.nameID==11 Preferred Family: 42 | record.nameID==12 Preferred Styles: 43 | """ 44 | 45 | # Postscript name 46 | # - no spaces allowed in family name or the PostScript suffix. should be dash delimited 47 | postscript_name = f"{new_family_name.replace(' ', '')}-{style.replace(' ', '')}" 48 | 49 | # modify the opentype table data in memory with updated values 50 | for i in range(len(name_records) - 1, -1, -1): 51 | record = name_records[i] 52 | if record.nameID == 1: 53 | record.string = new_family_name 54 | elif record.nameID == 4: 55 | record.string = f"{new_family_name} {style}" 56 | elif record.nameID == 6: 57 | record.string = postscript_name 58 | else: 59 | ... 60 | # TODO: delete other table data like WS family name 61 | # del name_records[i] 62 | try: 63 | tt.save(font_path) 64 | print(f"[OK] Updated '{font_path}' with the name '{new_family_name}'") 65 | except Exception as e: 66 | exit_with_error_msg(f""" 67 | [fontname.py] ERROR: unable to write new name to OpenType name table for {font_path}. 68 | """) 69 | 70 | 71 | def get_font_style(font_path, name_records) -> str: 72 | style = "" 73 | # determine font style for this file path from name record nameID 2 74 | for record in name_records: 75 | if record.nameID == 2: 76 | style = str(record) 77 | break 78 | 79 | # test that a style name was found in the OpenType tables of the font 80 | if len(style) == 0: 81 | exit_with_error_msg(f""" 82 | [fontname.py] ERROR: unable to detect the font style from the OpenType name table in {font_path}. 83 | Unable to complete execution of the script. 84 | """) 85 | return style 86 | 87 | 88 | def exit_with_error_msg(err_msg): 89 | sys.stderr.write(err_msg) 90 | sys.exit(1) 91 | 92 | 93 | def file_exists(filepath): 94 | """Tests for existence of a file on the string filepath""" 95 | return os.path.exists(filepath) and os.path.isfile(filepath) 96 | 97 | 98 | if __name__ == "__main__": 99 | main(sys.argv[1:]) 100 | -------------------------------------------------------------------------------- /screenshots/aurulent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/screenshots/aurulent.png -------------------------------------------------------------------------------- /screenshots/firacode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/screenshots/firacode.png -------------------------------------------------------------------------------- /screenshots/scp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhimoe/programming-fonts/46fe39c49a7abf03b3d644cd3dc73e9b987d16f3/screenshots/scp.png -------------------------------------------------------------------------------- /screenshots/screenshot_url: -------------------------------------------------------------------------------- 1 | ## screenshots config: 2 | https://carbon.now.sh/?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=3024-night&wt=sharp&l=auto&width=680&ds=true&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=monospace&fs=14px&lh=133%25&si=false&es=2x&wm=false&code=%252F%252F%2520Fira%2520Code%2520redesign%2520r%2520glyph%252C%2520narrow%2520width%2520to%2520600%250Aconst%2520pluckDeep%2520%253D%2520key%2520%253D%253E%2520obj%2520%253D%253E%2520key.split%28%27.%27%29.reduce%28%28accum%252C%2520key%29%2520%253D%253E%2520accum%255Bkey%255D%252C%2520obj%29%250A%250Aconst%2520compose%2520%253D%2520%28...fns%29%2520%253D%253E%2520res%2520%253D%253E%2520fns.reduce%28%28accum%252C%2520next%29%2520%253D%253E%2520next%28accum%29%252C%2520res%29%250A%250Aconst%2520unfold%2520%253D%2520%28f%252C%2520seed%29%2520%253D%253E%2520%257B%250A%2520%2520const%2520go%2520%253D%2520%28f%252C%2520seed%252C%2520acc%29%2520%253D%253E%2520%257B%250A%2520%2520%2520%2520const%2520res%2520%253D%2520f%28seed%29%250A%2520%2520%2520%2520return%2520res%2520%253F%2520go%28f%252C%2520res%255B1%255D%252C%2520acc.concat%28%255Bres%255B0%255D%255D%29%29%2520%253A%2520acc%250A%2520%2520%257D%250A%2520%2520return%2520go%28f%252C%2520seed%252C%2520%255B%255D%29%250A%257D -------------------------------------------------------------------------------- /update: -------------------------------------------------------------------------------- 1 | git checkout --orphan tmp && git add -A && git commit -am "programming fonts" && git branch -D master && git branch -m master && git push -f origin master --------------------------------------------------------------------------------