Chicago95 icon indicating copy to clipboard operation
Chicago95 copied to clipboard

MS Sans Serif kerning issue

Open 1chan-level-journalist opened this issue 3 years ago • 11 comments

I took bitmapped MS Sans Serif straight from Windows 95 and then converted it into something Linux could actually use as a font via Fontforge. On Debian 10 - no issues, everything is exactly how it was in Win95. But on Debian 11, letters would stick to each other. See pic: 1630957283732 Apparently it's because of the new Pango font rendering that GTK uses. It's been an issue for at least two years, and it doesn't look like they are gonna do anything about it. So I did the only thing left - create a new bitmapped font in Fontforge and re-trace every symbol from scratch. Now letters no longer stick to each other, just like before, but now there is another problem - the "new" font doesn't have a bold version (or italic for that matter). Interestingly, when I converted .fon bitmapped font into usable .ttf following the instructions, it already had Bold and Italic version. How would one get Fontforge to show them, so I can add them to my "new" font?

1chan-level-journalist avatar Sep 07 '21 18:09 1chan-level-journalist

Can you show me how did you retrace the font, please?

metropolis-nostalgia avatar Oct 02 '21 01:10 metropolis-nostalgia

First I opened SSERIFE.FON in Fontforge, opened Element->Bitmap Strikes Available, and looked up the contents of Pixel Sizes. Then I opened a new window, opened Element->Bitmap Strikes Available in it and wrote Pixel Sizes there (for some reason you can't just copy and paste things from different windows in Fontforge). Then I selected the right raster size in View (I started with 11) in both windows. After that it was just a matter of double-clicking on the same symbols in both windows and re-tracing them all. Oh, and before I did all that I had to make sure they have the exact same width - for this you'll need to right-click on the symbol in SSERIFE.FON, choose Set Width, look up the value that shows up and then change it in the new font. Once all that was done, I saved it as a .ttf in the same way that was described in INSTALL.md. That did it for me, but the lack of Bold font remains a problem.

1chan-level-journalist avatar Nov 07 '21 11:11 1chan-level-journalist

I can confirm this issue for another MS font. In my case, I was using Tahoma 8pt without hinting and with export FREETYPE_PROPERTIES="truetype:interpreter-version=35" in my /etc/environment to make it look like in Win XP. However, since Debian 11, I have the same problem as @1chan-level-journalist. It is especially noticeable for small font sizes, e.g. 8pt.

felsocim avatar Nov 19 '21 16:11 felsocim

@1chan-level-journalist is it possible for you to upload this retraced font?

CrashOveride95 avatar Jan 01 '22 17:01 CrashOveride95

See #218 for a solution

pkfbcedkrz avatar Jan 06 '22 03:01 pkfbcedkrz

@1chan-level-journalist is it possible for you to upload this retraced font?

Here: MSSansSerifRaster.ttf.tar.gz It is completely retraced from original SSERIFE.FON, pixel by pixel.

See #218 for a solution

Nice! However, some Cyrillic letters don't look quite right, unfortunately. Also some symbols are missing, such as Numero. That being said, the bold font renders properly, while mine is getting too squished. I'm not sure yet how to overcome that problem.

SneedSoft avatar Jan 06 '22 13:01 SneedSoft

@SneedSoft Thanks for the feedback. I've updated #218 to reflect this.

pkfbcedkrz avatar Jan 09 '22 02:01 pkfbcedkrz

I think I understand why the bold version of my font is too squished - the automatically generated bold version adds some pixels to the letters (it actually looks exactly like the bold version of MS Sans Serif), but does not change letter spacing, so the added pixels cross over the spacing and the end result look like this: Снимок экрана_2022-01-11_20-25-04 while it normally should like this: Снимок экрана_2022-01-11_20-27-04

Is it possible to adjust font spacing through fontconfig?

SneedSoft avatar Jan 11 '22 17:01 SneedSoft

I believe fontconfig might be able to adjust spacing by, for example, converting a proportional font to monospace. See the "spacing" attribute: https://www.freedesktop.org/software/fontconfig/fontconfig-user.html

But in terms of adjusting the spacing of individual letters, I don't think fontconfig can do that. Not to mention that, even if it could, some programs and desktop environments ignore it in favor of their own settings, so it would not be a global solution.

I believe the solution you are looking for involves replicating the bold version of MS Sans Serif as a separate font file - Arial, for example, uses separate files for Arial Regular and Arial Bold (arial.ttf and arialbd.ttf). I believe you are currently using auto-generated bold and italic versions from FontForge - I'm not sure how to disable that and replace it with a manually created bold / italic version, but that would be the sure-fire way to control the spacing properly.

pkfbcedkrz avatar Jan 12 '22 13:01 pkfbcedkrz

I believe fontconfig might be able to adjust spacing by, for example, converting a proportional font to monospace. See the "spacing" attribute: https://www.freedesktop.org/software/fontconfig/fontconfig-user.html

Hmm. There, indeed, appears to be a "spacing" property in fontconfig. However, trying to alter it with a .conf file doesn't seem to do anything. Here's the .conf file I attempted to write: 99-ms-sans-serif-bold.conf.txt

SneedSoft avatar Jan 12 '22 19:01 SneedSoft

OK, so I couldn't find a way to adjust the spacing of the synthetically-generated bold font. So I bit the bullet and started retracing the original Bold font as well. Here's a WIP version of it. Font sizes 8 and 10 (which are the most important to me) are already done: MSSansSerifRaster.tar.gz

SneedSoft avatar Jan 25 '22 14:01 SneedSoft