snowie2000 / mactype

Better font rendering for Windows.
https://mactype.net
GNU General Public License v3.0
10.07k stars 442 forks source link

Extremely slow rendering of the TTF version FuraCode font from the Nerd Fonts project #513

Open kailiu42 opened 5 years ago

kailiu42 commented 5 years ago

I'm using the FuraCode font from the Nerd Fonts project.

The problem is the TTF version is rendered really slow, while the OTF version is rendered normally. When using the TTF version, it took almost a second for the text on a PuTTY terminal window to display, progressively.

The problem might not be solely on MacType side, since if I exclude PuTTY I still can notice the text display is a bit lower than normal. But it is still acceptable. With MacType rendering, the slowness became so obvious that is almost not usable. Imaging a game running at 10FPS, that's the feeling.

OS: Windows 10 1809. MacType: 2018.1-beta5

snowie2000 commented 5 years ago

Alright, turns out that the FuraCode font has many different weights and several ttf files for each weight. Which specific version are you using?

kailiu42 commented 5 years ago

I'm using the "Mono Windows Compatible" fonts. Specifically these files:

Fura Code Bold Nerd Font Complete Mono Windows Compatible.ttf Fura Code Light Nerd Font Complete Mono Windows Compatible.ttf Fura Code Medium Nerd Font Complete Mono Windows Compatible.ttf Fura Code Regular Nerd Font Complete Mono Windows Compatible.ttf

snowie2000 commented 5 years ago

I haven't tested it in Windows10, but the font works very well in Windows 7. This is a screen recording from my Windows 7 system with Fira Code.

putty.zip

kailiu42 commented 5 years ago

I noticed the font name in the video and your comment is Fira Code. Did you tested the original Fira Code or the Fura Code from Nerd Fonts?

snowie2000 commented 5 years ago

I didn't see the FuraCode NF fonts because their names turned into garbled texts when MacType is enabled. I thought the name after installation is actually FiraCode 🤣

Checking the problem.

snowie2000 commented 5 years ago

qq 20190225164555 There is one problem: Even when I turned off the MacType and re-launch putty, the FuraCode NF fonts still refuse to show up. It is available in the list of Notepad and other applications.

kailiu42 commented 5 years ago

That's strange. I'm using the latest snapshot of PuTTY and I just tried the stable release 0.70, there is no problem to see FuraCode NF in the font dialog.

kailiu42 commented 5 years ago

Some latest test feedback:

snipaste_2019-02-26_20-43-14

snowie2000 commented 5 years ago

I noticed this problem on my first try and till now I finally got some time digging into it.

Turns out that the problem is from the font FuraCode NF, it incorrectly has the same UniqueID as the Fira Code: 1.206;CTDB;FiraCode-Light qq 20190228155415

Windows APIs use the UniqueID field as the full name of a font, and MacType distinguishes fonts with it. If two fonts have the same ID, they will be treated as a single font, thus drawing text with glyph index will result in garbled text.

snowie2000 commented 5 years ago

Just pushed a commit to improve the ability to distinguish fonts.

Now the font dialog looks normal but still got no luck to make the FuraCode NF show up in the putty.

qq 20190228165147

kailiu42 commented 5 years ago

On my system, the slowness it not solely on PuTTY, any program using the TTF FuraCode NF are slower than OTF. So maybe you can just try the NotePad, use it to open a large text file and scroll around to see the symptom.

kailiu42 commented 5 years ago

BTW my screen is 4K, does it make MacType rendering considerably slower?

sammilucia commented 5 years ago

On my computer MacType renders a bit slower than GDI or DirectWrite, but you would never notice. It is possible FuraCode TTF is just really poorly optimised (e.g. it draws font stems several times or has extremely complex paths).

snowie2000 commented 5 years ago

I didn't notice any slowing down when using FuraCode NF or Fira Code.

Although 4K can definitely slow things down, it shouldn't be that noticeable.

snowie2000 commented 5 years ago

MacType-fura-special.zip

Try this version. At least, it can correctly show the names of the two fonts.

kailiu42 commented 5 years ago

Yes the font name issue is gone.

sammilucia commented 5 years ago

@kraml is the slowness problem still occurring?

kailiu42 commented 5 years ago

Yes it is still slow. The latest build provided above only solved the font name issue.

sammilucia commented 5 years ago

@kraml okay thank you.