Last active
July 2, 2023 03:17
-
-
Save Tatsh/1d90ab3736f1eae6987015a2fcfe8c98 to your computer and use it in GitHub Desktop.
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
from struct import pack | |
from typing import Literal | |
def make_font_entry( | |
field: Literal['CaptionFont', 'IconFont', 'MenuFont', 'MessageFont', | |
'SmCaptionFont', 'StatusFont'], | |
name: str, | |
*, | |
char_set: Literal[0, 1, 2, 0x4d, 0x80, 0x81, 0x82, 0x86, 0x88, 0xa1, | |
0xa2, 0xa3, 0xb1, 0xb2, 0xba, 0xcc, 0xde, 0xee, | |
0xff] = 1, # DEFAULT_CHARSET | |
clip_precision: Literal[0, 1, 2, 0x10, 0x20, 0x40, 0x80] = 0, # CLIP_DEFAULT_PRECIS | |
dpi: int = 96, | |
escapement: int = 0, | |
font_size_pt: int = 9, | |
italic: bool = False, | |
orientation: int = 0, | |
out_precision: Literal[0, 1, 3, 4, 5, 6, 7, 8, 9, | |
0xa] = 0, # OUT_DEFAULT_PRECIS | |
pitch_and_family: int = 0b00100010, # (FF_SWISS << 4) | VARIABLE_PITCH | |
quality: Literal[0, 1, 2, 3, 4, 5] = 0, | |
strike_out: bool = False, | |
underline: bool = False, | |
weight: int = 400, # FW_NORMAL | |
width: int = 0): | |
packed = pack('<5l8b64s', -((font_size_pt * dpi) // 72), width, escapement, | |
orientation, weight, italic, underline, strike_out, char_set, | |
out_precision, clip_precision, quality, pitch_and_family, | |
name.encode('utf-16le').ljust(64, b'\0')) | |
lines = [] | |
line = f'"{field}"=hex:' | |
for n in packed: | |
line += f'{n:02x},' | |
lc = len(lines) | |
if (lc == 0 and len(line) == 78) or (lc > 0 and len(line) == 77): | |
line += '\\' | |
lines.append(line) | |
line = ' ' | |
lines.append(line.rstrip(',')) | |
return '\n'.join(lines) | |
# print(make_font_entry('MenuFont', 'Noto Sans', weight=700)) | |
# "MenuFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,bc,02,00,00,00,\ | |
# 00,00,01,00,00,00,22,4e,00,6f,00,74,00,6f,00,20,00,53,00,61,00,6e,00,73,00,\ | |
# 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ | |
# 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 |
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
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes] | |
"Arial Baltic,186"="Noto Sans" | |
"Arial CE,238"="Noto Sans" | |
"Arial CYR,204"="Noto Sans" | |
"Arial Greek,161"="Noto Sans" | |
"Arial TUR,162"="Noto Sans" | |
"Courier New Baltic,186"="Noto Sans" | |
"Courier New CE,238"="Noto Sans" | |
"Courier New CYR,204"="Noto Sans" | |
"Courier New Greek,161"="Noto Sans" | |
"Courier New TUR,162"="Noto Sans" | |
"Helv"="Noto Sans" | |
"Helvetica"="Noto Sans" | |
"MS Shell Dlg"="Noto Sans" | |
"MS Shell Dlg 2"="Noto Sans" | |
"MS Sans Serif"="Noto Sans" | |
"Segoe UI"="Noto Sans" | |
"System"="Noto Sans" | |
"Tahoma"="Noto Sans" | |
"Times"="Noto Sans" | |
"Times New Roman Baltic,186"="Noto Sans" | |
"Times New Roman CE,238"="Noto Sans" | |
"Times New Roman CYR,204"="Noto Sans" | |
"Times New Roman Greek,161"="Noto Sans" | |
"Times New Roman TUR,162"="Noto Sans" | |
"Tms Rmn"="Noto Sans" | |
"Verdana"="Noto Sans" | |
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics] | |
"CaptionFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,bc,02,00,00,\ | |
00,00,00,01,00,00,00,22,4e,00,6f,00,74,00,6f,00,20,00,53,00,61,00,6e,00,73,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 | |
"IconFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\ | |
00,00,01,00,00,00,22,4e,00,6f,00,74,00,6f,00,20,00,53,00,61,00,6e,00,73,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 | |
"MenuFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\ | |
00,00,01,00,00,00,22,4e,00,6f,00,74,00,6f,00,20,00,53,00,61,00,6e,00,73,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 | |
"MessageFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\ | |
00,00,00,01,00,00,00,22,4e,00,6f,00,74,00,6f,00,20,00,53,00,61,00,6e,00,73,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 | |
"SmCaptionFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\ | |
00,00,00,01,00,00,00,22,4e,00,6f,00,74,00,6f,00,20,00,53,00,61,00,6e,00,73,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 | |
"StatusFont"=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\ | |
00,00,00,01,00,00,00,22,4e,00,6f,00,74,00,6f,00,20,00,53,00,61,00,6e,00,73,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ | |
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment