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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
# How to update font packs
## FontAwesome
To update _FontAwesome_ icons, one must:
- check what is the latest released version here: https://github.com/FortAwesome/Font-Awesome/releases/
- run: `python setup.py update_fa5 --fa-version X.X.X`
- update FA version number, icon counts and URLs inside:
- README.md
- qtawesome/docs/source/usage.rst
## Elusive Icons
To update _Elusive Icons_, one must:
- replace the ttf font file with the new version
- regenerate the json charmap with the `icons.yml` file from the upstream repository:
- update Elusive Icons version number, icon counts and URLs inside:
- README.md
- qtawesome/docs/source/usage.rst
```Python
import yaml, json
with open('icons.yml', 'r') as file:
icons = yaml.load(file)['icons']
charmap = {icon['id']: icon['unicode'] for icon in icons}
for icon in icons:
if 'aliases' in icon:
for name in icon['aliases']:
charmap[name] = icon['unicode']
with open('charmap.json', 'w') as file:
json.dump(charmap, file, indent=4, sort_keys=True)
```
## Material Design Icons
To update _Material Design Icons 6.x_, you must:
- download ttf from <https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/fonts/materialdesignicons-webfont.ttf>
- regenerate the json charmap with the `materialdesignicons.css` file from <https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/css/materialdesignicons.css>
- update Material Design Icons version number, icon counts and URLs inside:
- README.md
- qtawesome/docs/source/usage.rst
The following script automatically download the last TTF font, generate the json charmap and display md5 hash of the TTF (to update \_\_init__.py)
```Python
import re
import json
import urllib.request
import hashlib
TTF_URL = 'https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/fonts/materialdesignicons-webfont.ttf'
CSS_URL = 'https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/css/materialdesignicons.css'
with open('materialdesignicons6-webfont.ttf', 'wb') as fp:
req = urllib.request.urlopen(TTF_URL)
if req.status != 200:
raise Exception('Failed to download TTF')
fp.write(req.read())
req.close()
hasher = hashlib.md5()
with open('materialdesignicons6-webfont.ttf', 'rb') as f:
content = f.read()
hasher.update(content)
ttf_calculated_hash_code = hasher.hexdigest()
print('MD5 :', ttf_calculated_hash_code)
req = urllib.request.urlopen(CSS_URL)
if req.status != 200:
raise Exception('Failed to download CSS Charmap')
rawcss = req.read().decode()
req.close()
charmap = {}
pattern = '^\.mdi-(.+)::before {\s*content: "(.+)";\s*}$'
data = re.findall(pattern, rawcss, re.MULTILINE)
for name, key in data:
key = key.replace('\\F', '0xf').lower()
key = key.replace('\\', '0x')
name = name.lower()
charmap[name] = key
with open('materialdesignicons6-webfont-charmap.json', 'w') as fp:
json.dump(charmap, fp, indent=4, sort_keys=True)
```
## Phosphor
To update _Phosphor_, you must:
- download ttf from <https://raw.githubusercontent.com/phosphor-icons/phosphor-icons/master/src/font/phosphor.ttf>
- regenerate the json charmap with the `phosphor.css` file from <https://raw.githubusercontent.com/phosphor-icons/phosphor-icons/master/src/css/phosphor.css>
- update Phosphor version number, icon counts and URLs inside:
- README.md
- qtawesome/docs/source/usage.rst
The following script automatically download the last TTF font, generate the json charmap and display md5 hash of the TTF (to update \_\_init__.py)
```Python
import re
import json
import urllib.request
import hashlib
TTF_URL = 'https://raw.githubusercontent.com/phosphor-icons/phosphor-icons/master/src/font/phosphor.ttf'
CSS_URL = 'https://raw.githubusercontent.com/phosphor-icons/phosphor-icons/master/src/css/phosphor.css'
with open('phosphor.ttf', 'wb') as fp:
req = urllib.request.urlopen(TTF_URL)
if req.status != 200:
raise Exception('Failed to download TTF')
fp.write(req.read())
req.close()
hasher = hashlib.md5()
with open('phosphor.ttf', 'rb') as f:
content = f.read()
hasher.update(content)
ttf_calculated_hash_code = hasher.hexdigest()
print('MD5 :', ttf_calculated_hash_code)
req = urllib.request.urlopen(CSS_URL)
if req.status != 200:
raise Exception('Failed to download CSS Charmap')
rawcss = req.read().decode()
req.close()
charmap = {}
pattern = '^\.ph-(.+):before {\s*content: "(.+)";\s*}$'
data = re.findall(pattern, rawcss, re.MULTILINE)
for name, key in data:
key = key.replace('\\', '0x')
name = name.lower()
charmap[name] = key
with open('phosphor-charmap.json', 'w') as fp:
json.dump(charmap, fp, indent=4, sort_keys=True)
```
## Remix Icon
To update _Remix Icon_, you must:
- download ttf from <https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/fonts/remixicon.ttf>
- regenerate the json charmap with the `remixicon.css` file from <https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/fonts/remixicon.css>
- update Remix Icon version number, icon counts and URLs inside:
- README.md
- qtawesome/docs/source/usage.rst
The following script automatically download the last TTF font, generate the json charmap and display md5 hash of the TTF (to update \_\_init__.py)
```Python
import re
import json
import urllib.request
import hashlib
TTF_URL = 'https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/fonts/remixicon.ttf'
CSS_URL = 'https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/fonts/remixicon.css'
with open('remixicon.ttf', 'wb') as fp:
req = urllib.request.urlopen(TTF_URL)
if req.status != 200:
raise Exception('Failed to download TTF')
fp.write(req.read())
req.close()
hasher = hashlib.md5()
with open('remixicon.ttf', 'rb') as f:
content = f.read()
hasher.update(content)
ttf_calculated_hash_code = hasher.hexdigest()
print('MD5 :', ttf_calculated_hash_code)
req = urllib.request.urlopen(CSS_URL)
if req.status != 200:
raise Exception('Failed to download CSS Charmap')
rawcss = req.read().decode()
req.close()
charmap = {}
pattern = '^\.ri-(.+):before {\s*content: "(.+)";\s*}$'
data = re.findall(pattern, rawcss, re.MULTILINE)
for name, key in data:
key = key.replace('\\', '0x')
name = name.lower()
charmap[name] = key
with open('remixicon-charmap.json', 'w') as fp:
json.dump(charmap, fp, indent=4, sort_keys=True)
```
## Microsoft's Codicons
To update _Codicons_ icons, one must:
- check what is the latest released version here: https://github.com/microsoft/vscode-codicons/releases
- run: `python setup.py update_msc`
- update Codicons version number, icon counts and URLs inside:
- README.md
- qtawesome/docs/source/usage.rst
|