Different font margin when specifying "monospace" generic font

263 Views Asked by At

When specifying "monospace" with Chinese text in Chrome on OSX, it will correctly render PingFang SC, however the rendered font will be exactly 2 pixels higher than rendering the exact same font by directly using "PingFang SC". Demo:

enter image description here https://jsbin.com/mahuqub/edit?html,output

1) font-family: monospace;
2) font-family: PingFang SC;

This is not a line-height issue as I can see the same result setting the line height exactly the same. I've also noticed certain issues like special characters/spaces taking up different space when the "lang" attribute isn't correctly set, however controlling for that here by setting the "lang" and not using special characters at all. Also note that Chrome claims PingFang SC is being rendered. I've also made sure that there is only the default "PingFang SC" font on my system, no other user installed fonts exist. I also haven't noticed this behavior with monospace generics in other scripts (hrkt/hang and of course Latin etc).

My questions are:

1) Why would "monospace" render the exact same font differently?

2) Is there any way to detect this?

0

There are 0 best solutions below