1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
   |  import os, re
  def get_posh_symbols(root):          files = []          default_file = os.path.join(root, 'defaults.ps1')      files.append(default_file)               themes_dir = os.path.join(root, 'Themes')     for parent, dirnames, filenames in os.walk(themes_dir):         for filename in filenames:             filedir = os.path.join(parent, filename)             files.append(filedir)     print('All config files:\n ', '\n  '.join(files))
           symbols = []     for file in files:         with open(file, 'r', encoding='utf8') as f:             res = f.read(50000)             chars = re.findall("0x[0-9A-F]{4}", res)             symbols.extend(chars)          symbols = sorted(list(set(symbols)))          for i in posh_symbols:         print(f'{  i:8s} {chr(int(i, base=16)):4s}')          return symbols
  posh_root = r'C:\Users\xxxx\scoop\apps\oh-my-posh\current' posh_symbols = get_posh_symbols(posh_root)
 
 
  from PIL import  Image,ImageDraw,ImageFont
  ttfont = ImageFont.truetype("JetBrainsMono-Regular.ttf", 16)
  dict = {'0x00BB': 'Right-Pointing Double Angle Quotation Mark',         '0x2191': 'Upwards Arrow',         '0x2193': 'Downwards Arrow',         '0x2262': 'Not Identical To',         '0x2263': 'Strictly Equivalent To',         '0x250C': 'Box Drawings Light Down And Right',         '0x2514': 'Box Drawings Light Up And Right',         '0x25B6': 'Black Right-Pointing Triangle',         '0x25F7': 'White Circle With Upper Right Quadrant',         '0x26A1': 'High Voltage Sign',         '0x276F': 'Heavy Right-Pointing Angle Quotation Mark Ornament',         '0x279C': 'Heavy Round-Tipped Rightwards Arrow',         '0x2A2F': 'Vector Or Cross Product',         '0xE0A0': 'Version Control Branch',         '0xE0A1': 'LN (line) Symbol',         '0xE0A2': 'Closed Padlock',         '0xE0B0': 'Rightwards Black Arrowhead',         '0xE0B1': 'Rightwards Arrowhead',         '0xE0B2': 'Leftwards Black Arrowhead',         '0xE0B3': 'Leftwards Arrowhead',         '0xE606': 'Python Logo',         '0xF09B': 'Github Logo',         '0xF171': 'Bitbucket Logo',         '0xF296': 'GitLab Logo',         '0x0000': '',         '0x27E9': 'Mathematical Right Angle Bracket',         '0x2260': 'Not Equal To',         '0x2261': 'Identical To',         '0x2717': 'BALLOT X'         }
  def show_posh_fonts():         im = Image.new('RGBA', (600, 600), (255, 255, 255))     draw = ImageDraw.Draw(im)
      txt = '\n'.join([f'{i} {chr(int(i, base=16))} {dict[i]}' for i in dict])     print(txt)
      draw.text((5,5), txt, fill=(0,0,0),font=ttfont)     im.show()
  show_posh_fonts()
 
 
  from PIL import  Image, ImageDraw, ImageFont
  ttfont = ImageFont.truetype("JetBrainsMono-Regular.ttf", 16)
  def show_all_fonts(list):     im = Image.new('RGBA', (1600, 800), (255, 255, 255))          for st, x, y in list:         txt = ''         for i in range(st, st + 0x0100):             if i % 16 == 0:                 txt += f'\n {hex(i):6s} '             txt += f'{chr(i):2s}'         print(txt)
          draw = ImageDraw.Draw(im)         draw.text((x, y+20), txt, fill=(0,0,0),font=ttfont)     im.show()
  list = [[0x2100, 0, 0],         [0x2200, 400, 0],         [0x2300, 800, 0],         [0x2400, 1200, 0],         [0x2500, 0, 400],         [0x2600, 400, 400],         [0x2700, 800, 400],         [0xE000, 1200, 400], ]
  show_all_fonts(list)
 
 
 
  |