mintty / wsltty

Mintty as a terminal for Bash on Ubuntu on Windows / WSL
Other
3.11k stars 104 forks source link

[Question] Is there a way to align `FontChoice` font ? #341

Closed fengyichui closed 1 year ago

fengyichui commented 1 year ago

Hi,

Some characters (I used font is Iosevka) are much higher than my CJK (font is Microsoft YaHei UI) characters, look like follow: font

My font config:

Font=Iosevka Term
FontHeight=12
FontChoice=CJK:5
Font5=Microsoft YaHei UI

Is there a way (or options) to pan up CJK font a bit or align those different font?

mintty commented 1 year ago

Please provide a download link to the Iosevka Term font. How does it look with other fonts?

mintty commented 1 year ago

Asking because it looks fine for me with most fonts, including Iosevka. It may be a font problem of Iosevka Term.

fengyichui commented 1 year ago

The download link is here. The Iosevka Term and Iosevka looks very similar and they are all more taller than my CJK font. The very old version of this font looks well.

fengyichui commented 1 year ago

I try Windows Font fallback:

 REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fontlink\SystemLink" /v Iosevka /t REG_MULTI_SZ /d "MSYH.TTC,Microsoft YaHei UI,128,96"\0"MSYH.TTC,Microsoft YaHei UI"\0"SEGOEUI.TTF,Segoe UI,120,80"\0"SEGOEUI.TTF,Segoe UI"\0"SIMSUN.TTC,SimSun"\0"MSJH.TTC,Microsoft Jhenghei UI"\0"MEIRYO.TTC,Meiryo UI"\0"MALGUN.TTF,Malgun Gothic,128,96"\0"MALGUN.TTF,Malgun Gothic"\0"YUGOTHM.TTC,Yu Gothic UI,128,96"\0"YUGOTHM.TTC,Yu Gothic UI"\0"SEGUISYM.TTF,Segoe UI Symbol"

And remove wsltty config:

FontChoice=CJK:5
Font5=Microsoft YaHei UI

Those English and CJK font looks good (aligned): 1

mintty commented 1 year ago

I installed Iosevka Term from your link (ttf archive in case that matters) and used your config which looks good here: grafik Microsoft Yahei UI version is 6.30.

fengyichui commented 1 year ago

Did you uninstall all older versions of Iosevka before installing it? My Microsoft Yahei UI version is 6.24, where do you download the version 6.30?

mintty commented 1 year ago

Iosevka Term was not installed before. Yahei UI came with Windows, maybe you should run an update.

fengyichui commented 1 year ago

I found this problem related to FontHeight, if it is equal to 12 it look bad, equal to 14 is no problem. What is your configuration FontHeight?

mintty commented 1 year ago

I can reproduce the issue, kind of. But it depends on the actual characters used, how this looks: grafik With this example, it seems that CJK characters also have some descender, like Latin. In this picture there is even more descender in the Latin g than in the CJK characters. Checking the baseline, there is 1 pixel offset. I guess 1 pixel is nothing that can be completely excluded in rendering, given rounding errors. The CJK in this picture could be scaled a bit larger, though, but that's done by Windows.

fengyichui commented 1 year ago

Thanks! Using Windows Font Fallback is also a good choice.

mintty commented 1 year ago

For the records, DPI (display "scaling") also has an effect; my first screenshot (good) was at 125%, my second (confirming the issue) at 100% with 12pt font size.

fengyichui commented 1 year ago

This may be a problem with Windows font rendering, and Windows Font Fallback may have done some special processing internally.

mintty commented 1 year ago

The CJK font could be created a pinch bigger, like 1 pixel for 12pt font size, to compensate the problem. However, it seems impossible to find heuristic criteria when to apply this tuning. The same modification that helps for YaHei makes things worse for Yu Gothic and they have the same font metrics.

I'm considering a mechanism instead by which a specific font can be tuned a bit bigger by configuration.

mintty commented 1 year ago

Released 3.7.0.