jonz94 / Sarasa-Gothic-Nerd-Fonts

Nerd fonts patched Sarasa Gothic font.
MIT License
206 stars 10 forks source link

修复macOS下高度不一致 #17

Closed xiehuc closed 1 year ago

xiehuc commented 1 year ago

image

安装最新的 0.4.0 的效果。每个字符上面有额外的间距,导致符号和文字背景对不齐

经过大量测试,使用下面的脚本可以修复。(在linux上执行的,mac上好像也可以安装fonttools来搞)

#!/bin/bash
mkdir $1-fix
for font in "$1"/*.ttf; do
  ttx -o hhea.ttx -t "hhea" "$font"
  sed -i -E 's/(ascent.value=.)[0-9]+/\1785/' hhea.ttx
  ttx -o $1-fix/$(basename "$font") -m "$font" hhea.ttx
done
fix-mac-ascent.sh
sarasa-mono-sc-nerd-font
├── sarasa-mono-sc-bold-nerd-font.ttf
├── sarasa-mono-sc-bolditalic-nerd-font.ttf
├── sarasa-mono-sc-extralight-nerd-font.ttf
├── sarasa-mono-sc-extralightitalic-nerd-font.ttf
├── sarasa-mono-sc-italic-nerd-font.ttf
├── sarasa-mono-sc-light-nerd-font.ttf
├── sarasa-mono-sc-lightitalic-nerd-font.ttf
├── sarasa-mono-sc-regular-nerd-font.ttf
├── sarasa-mono-sc-semibold-nerd-font.ttf
└── sarasa-mono-sc-semibolditalic-nerd-font.ttf

效果就非常和谐了。

截屏2023-02-10 01 56 59
xiehuc commented 1 year ago

看了下应该是iterm的bug。打扰了

jonz94 commented 1 year ago

Hi, sorry for the late reply.

I think the root cause might be the same as https://github.com/ryanoasis/nerd-fonts/issues/1056, which has already been fixed in nerd fonts v2.3.2

Therefore, using Sarasa-Gothic-Nerd-Fonts version 0.39.0-0 (which update the nerd fonts to v2.3.3) onward should be able to fix the issue.

xiehuc commented 1 year ago

👍👍,测试了下应该是没这个问题了。