fiddle icon indicating copy to clipboard operation
fiddle copied to clipboard

CoreText note: Client requested name ".NewYork-Regular"

Open erickzhao opened this issue 3 years ago • 2 comments

When running Fiddle locally, one encounters the following log messages:

2021-03-02 16:33:37.316 Electron Helper (Renderer)[46761:3074059] CoreText note: Client requested name ".NewYork-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2021-03-02 16:33:37.316 Electron Helper (Renderer)[46761:3074059] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
2021-03-02 16:33:37.321 Electron Helper (Renderer)[46761:3074059] CoreText note: Client requested name ".NewYork-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].

Apparently, this is due to an upstream issue with Monaco.

ref https://github.com/microsoft/vscode/issues/98597

erickzhao avatar Mar 03 '21 00:03 erickzhao

I have spent some time investigating this issue. The problem was found to be caused by chromium.

Reproduction code:

@font-face {
  font-family: system;
  font-style: normal;
  font-weight: 300;
  src: local(".NewYork-Regular");
}
h1 {
  font-family: "system";
}

From Xcode 11 onwards, this warning will be raised. This problem is still present in the latest Chrome.

In electron-fiddle:

gist: https://gist.github.com/BlackHole1/ca89d41a5469b0d80be9362c6b62487b

https://user-images.githubusercontent.com/8198408/156978338-b21e8b01-2a90-4481-acf0-a2fea3017db9.mp4

In chrome:

gist: https://gist.github.com/BlackHole1/91a22621ac4f912d85235850d2eafdc6

https://user-images.githubusercontent.com/8198408/156979003-b130602d-032b-4373-9bbc-88954415e174.mp4


crbug link: https://bugs.chromium.org/p/chromium/issues/detail?id=1131559


Causes of this problem:

This warning is triggered as soon as CTFontCreateWithName or [UIFont fontWithName:fontName size:fontSize] is used.

BlackHole1 avatar Mar 07 '22 06:03 BlackHole1

At the moment I see that the chromium team doesn't know how to reproduce the problem and I will go and talk to them.

BlackHole1 avatar Mar 07 '22 06:03 BlackHole1