Override the current font’s vertical metrics with those of another font.
What do you mean?
Copy, paste.
Can all be copied and pasted at once?
Yes. Just try it.
I won’t be fooled. Is there really no other way?
To do what?
Migrate all vertical metrics of a font to another font at once.
Then copy them over.
You mean for all masters? Copy pasting would only do it for the current master. For all masters that have the same vertical metrics, you should be able to select them in the left list and paste to all of them.
from fontTools.ttLib import TTFont
src = TTFont("源字体.otf") # 提供度量的一方
dst = TTFont("目标字体.otf") # 被替换的一方
k = dst["head"].unitsPerEm / src["head"].unitsPerEm # UPM 不同时按比例换算
hhea, os2 = dst["hhea"], dst["OS/2"]
s_hhea, s_os2 = src["hhea"], src["OS/2"]
hhea.ascent, hhea.descent, hhea.lineGap = (
round(s_hhea.ascent * k),
round(s_hhea.descent * k),
round(s_hhea.lineGap * k),
)
os2.sTypoAscender = round(s_os2.sTypoAscender * k)
os2.sTypoDescender = round(s_os2.sTypoDescender * k)
os2.sTypoLineGap = round(s_os2.sTypoLineGap * k)
os2.usWinAscent = round(s_os2.usWinAscent * k)
os2.usWinDescent = round(s_os2.usWinDescent * k)
dst.save("目标字体_迁移后.otf")
——fontTools——
能不能把这个功能在Glyphs 3 里用图形界面的方式实现?
Can this feature be implemented in Glyphs 3 using a graphical interface?
That would not work as good in Glyphs. Importing a font file and converting it into Glyphs’ objects and exporting it again will not produce the same binary and some details will be lost. You can compare it to the difference between an Indesign file and a .pdf.

