Update README.md
This commit is contained in:
95
.scripts/modify-psname.py
Normal file
95
.scripts/modify-psname.py
Normal file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
from fontTools.ttLib import TTFont
|
||||
from fontTools.ttLib.ttCollection import TTCollection
|
||||
except ImportError:
|
||||
print("fontTools not installed. Please install with: pip install fonttools")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def modify_ttc_psname_fonttools(input_path, new_psname, output_path):
|
||||
"""使用 fonttools 修改 TTC 文件的 PostScript 名称"""
|
||||
|
||||
try:
|
||||
# 检查是否为 TTC 文件
|
||||
if input_path.lower().endswith('.ttc'):
|
||||
# 打开 TTC 文件
|
||||
ttc = TTCollection(input_path)
|
||||
print(f"Found {len(ttc.fonts)} fonts in TTC file")
|
||||
|
||||
for i, font in enumerate(ttc.fonts):
|
||||
print(f"Processing font {i+1}/{len(ttc.fonts)}")
|
||||
|
||||
# 修改 name 表中的各种名称
|
||||
name_table = font['name']
|
||||
|
||||
# 为多字体 TTC 添加索引后缀
|
||||
psname = f"{new_psname}-{i}" if len(ttc.fonts) > 1 else new_psname
|
||||
family_name = new_psname.split('-')[0] if '-' in new_psname else new_psname
|
||||
full_name = f"{new_psname} {i}" if len(ttc.fonts) > 1 else new_psname
|
||||
|
||||
for record in name_table.names:
|
||||
if record.nameID == 1: # Font family name
|
||||
record.string = family_name
|
||||
elif record.nameID == 4: # Full font name
|
||||
record.string = full_name
|
||||
elif record.nameID == 6: # PostScript name
|
||||
record.string = psname
|
||||
|
||||
print(f" PostScript name: {psname}")
|
||||
print(f" Family name: {family_name}")
|
||||
print(f" Full name: {full_name}")
|
||||
|
||||
# 保存修改后的 TTC
|
||||
ttc.save(output_path)
|
||||
print(f"Successfully saved modified TTC: {output_path}")
|
||||
|
||||
else:
|
||||
# 处理单个 TTF 文件
|
||||
font = TTFont(input_path)
|
||||
name_table = font['name']
|
||||
|
||||
family_name = new_psname.split('-')[0] if '-' in new_psname else new_psname
|
||||
|
||||
for record in name_table.names:
|
||||
if record.nameID == 1: # Font family name
|
||||
record.string = family_name
|
||||
elif record.nameID == 4: # Full font name
|
||||
record.string = new_psname
|
||||
elif record.nameID == 6: # PostScript name
|
||||
record.string = new_psname
|
||||
|
||||
font.save(output_path)
|
||||
print(f"Successfully saved modified TTF: {output_path}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error modifying font file: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 4:
|
||||
print("Usage: python modify-psname-fonttools.py <input_font> <new_psname> <output_font>")
|
||||
print("Example: python modify-psname-fonttools.py input.ttc 'Microsoft YaHei' output.ttc")
|
||||
sys.exit(1)
|
||||
|
||||
input_path = sys.argv[1]
|
||||
new_psname = sys.argv[2]
|
||||
output_path = sys.argv[3]
|
||||
|
||||
if not os.path.exists(input_path):
|
||||
print(f"Input file does not exist: {input_path}")
|
||||
sys.exit(1)
|
||||
|
||||
modify_ttc_psname_fonttools(input_path, new_psname, output_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 直接调用示例
|
||||
modify_ttc_psname_fonttools("/home/kolkas/Downloads/wqy/wqy-zenhei.ttc",
|
||||
"Microsoft YaHei",
|
||||
"/home/kolkas/Downloads/wqy/wqy-zenhei-modified.ttc")
|
||||
22
README.md
22
README.md
@@ -1,13 +1,21 @@
|
||||
<!--
|
||||
* @Author: Uyanide pywang0608@foxmail.com
|
||||
* @Date: 2025-06-24 17:56:20
|
||||
* @LastEditTime: 2025-08-01 19:17:57
|
||||
* @LastEditTime: 2025-08-02 17:27:06
|
||||
* @Discription:
|
||||
-->
|
||||
|
||||
<img src="https://github.com/Uyanide/backgrounds/blob/master/screenshots/desktop.jpg?raw=true"/>
|
||||
<img src="https://github.com/Uyanide/backgrounds/blob/master/screenshots/tiling.jpg?raw=true"/>
|
||||
<img src="https://github.com/Uyanide/backgrounds/blob/master/screenshots/grub.jpg?raw=true"/>
|
||||
## Screenshots
|
||||
|
||||
- desktop with a few widgets:
|
||||
<img src="https://github.com/Uyanide/backgrounds/blob/master/screenshots/desktop.jpg?raw=true"/>
|
||||
<img src="https://github.com/Uyanide/backgrounds/blob/master/screenshots/tiling.jpg?raw=true"/>
|
||||
|
||||
- dynamic flavor based on Catppuccin Mocha:
|
||||
<img src="https://github.com/Uyanide/backgrounds/blob/master/screenshots/desktop-alt.jpg?raw=true"/>
|
||||
|
||||
- the grub menu looks like:
|
||||
<img src="https://github.com/Uyanide/backgrounds/blob/master/screenshots/grub.jpg?raw=true"/>
|
||||
|
||||
## Setup Overview
|
||||
|
||||
@@ -16,8 +24,8 @@
|
||||
- **Bar**: Waybar
|
||||
- **Shell**: Fish
|
||||
- **Prompt**: Oh My Posh
|
||||
- **Terminal**: Kitty & Ghostty (floating)
|
||||
- **Colorscheme**: Catppuccin-mocha (dynamic flavor)
|
||||
- **Terminal**: Kitty & Ghostty
|
||||
- **Colorscheme**: Catppuccin-mocha
|
||||
- **App Launcher**: Rofi
|
||||
- **Logout Screen**: Wlogout
|
||||
- **Desktop Widgets**: Eww
|
||||
@@ -30,7 +38,7 @@ Based on [end-4/dots-hyprland](https://github.com/end-4/dots-hyprland) but witho
|
||||
## Eww
|
||||
|
||||
- `main`, main dashboard, modified from [syndrizzle/hotfiles](https://github.com/syndrizzle/hotfiles/tree/bspwm) without notification center.
|
||||
- `lyrics`, scrolling lyrics player, dependents on api from [akashrchandran/spotify-lyrics-api](https://github.com/akashrchandran/spotify-lyrics-api) and [a small program](https://github.com/Uyanide/spotify-lyrics) from myself <small>(which also happens to be my frist Golang program :D)</small>.
|
||||
- `lyrics`, scrolling lyrics player, dependents on [a small program](https://github.com/Uyanide/spotify-lyrics) from myself <small>(which also happens to be my frist Golang program :D)</small>.
|
||||
- `lyrics-single`, similar to `lyrics`, but only with a single line and can be easily embeded into the status bar.
|
||||
|
||||
## Rofi
|
||||
|
||||
Submodule backgrounds updated: 0f7914d346...9f148001d6
@@ -103,7 +103,7 @@ bind = Super+Alt, F, fullscreenstate, 0 3 # Toggle fake fullscreen
|
||||
bind = Super, F, fullscreen, 0
|
||||
bind = Super, D, fullscreen, 1
|
||||
bind = Super, J, togglesplit
|
||||
bind = Super, P, pseudo
|
||||
# bind = Super, P, pseudo
|
||||
|
||||
#!
|
||||
##! Workspace navigation
|
||||
|
||||
Reference in New Issue
Block a user