2

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?

Andrew
  • 606
  • 4
  • 13
  • I can't reproduce this. I need to change the font in the JSBin to one that exists on my machine, but then the two lines of output are identical. But it may be that the font metrics for the two fonts on your machine are different - with the same font size, the default font used for monospace may have different descender and X-height sizes than PingFang. – Mr Lister May 08 '18 at 18:14
  • Hey, if you remove everything but the Chinese characters from the paragraphs, do they still differ? – Mr Lister May 08 '18 at 18:16
  • @MrLister PingFang SC is default on OSX... are you on Windows? If so it may not be reproduceable as it could be an issue with the font itself. Also, no the paragraphs are exactly the same even with only Chinese characters... just added the English for clarity. – Andrew May 08 '18 at 18:25
  • On Linux here, and my machine doesn't have PingFang, so I can't compare the metrics. Sorry I can't help then. – Mr Lister May 08 '18 at 18:39
  • Thanks anyway! Added macos tag to this as it's likely specific to OSX or even this specific font. – Andrew May 08 '18 at 18:51

0 Answers0