Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narrow CN character width #249

Open
subframe7536 opened this issue Sep 20, 2024 · 5 comments
Open

Narrow CN character width #249

subframe7536 opened this issue Sep 20, 2024 · 5 comments
Labels
help wanted Cannot handle this issue and need some help

Comments

@subframe7536
Copy link
Owner

subframe7536 commented Sep 20, 2024

Currently only supported in VSCode, have no effect in terminal and IDEA

maple-font/build.py

Lines 534 to 550 in ff02c20

def change_char_width(font: TTFont, match_width: int, target_width: int):
font["hhea"].advanceWidthMax = target_width
for name in font.getGlyphOrder():
glyph = font["glyf"][name]
width, lsb = font["hmtx"][name]
if width != match_width:
continue
if glyph.numberOfContours == 0:
font["hmtx"][name] = (target_width, lsb)
continue
delta = round((target_width - width) / 2)
glyph.coordinates.translate((delta, 0))
glyph.xMin, glyph.yMin, glyph.xMax, glyph.yMax = (
glyph.coordinates.calcIntBounds()
)
font["hmtx"][name] = (target_width, lsb + delta)

@subframe7536 subframe7536 added the help wanted Cannot handle this issue and need some help label Sep 20, 2024
@subframe7536
Copy link
Owner Author

Clip_2024-09-20_16-53-46

@subframe7536 subframe7536 changed the title Narrow character width Narrow CN character width Dec 6, 2024
@alrcatraz
Copy link

same problem! will also show in browser (e.g. Chrome) and notepad apps

in Notesheet App:
Image

in Chrome:
Image

@GrayArashiAI
Copy link

我认为这是为了对齐中英文宽度?

@subframe7536
Copy link
Owner Author

我认为这是为了对齐中英文宽度?

并不是,有些人对于中英文对齐无感,但是对于中文字符间距过大无法接受,所以打算提供一个构建选项

@alrcatraz
Copy link

我认为这是为了对齐中英文宽度?

应该是中英文字宽的不同导致的。就我所知的话,一般英文字体宽度会是600,而中文是1000,这就导致直接按照1:2排列时中文字符之间会有更大的间距。有一些字体会选择只压缩英文字符宽度,这则会导致英文字符看起来瘦瘦高高。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Cannot handle this issue and need some help
Projects
None yet
Development

No branches or pull requests

3 participants