Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

CoreText Issue on OS X Mavericks. For best performance, only use PostScript names when calling CTFontCreateWithName() #11418

Closed
wisesimpson opened this issue Jun 19, 2013 · 142 comments
Assignees

Comments

@wisesimpson
Copy link

When I run phantoms 1.9.1 (downloaded) on the new OS X Mavericks, I got this:

2013-06-19 23:46:05.765 phantomjs[6149:507] CoreText performance note: Client called CTFontCreateWithName() using name "Times New Roman" and got font with PostScript name "TimesNewRomanPSMT". For best performance, only use PostScript names when calling this API.
2013-06-19 23:46:05.767 phantomjs[6149:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.

I think change the "Times New Roman" to "TimesNewRomanPSMT" may fix the issue.

@felixbuenemann
Copy link

The same error happens with capybara-webkit on Mavericks.

@yozloy
Copy link

yozloy commented Aug 8, 2013

Same here pretty annoying

@yozloy
Copy link

yozloy commented Aug 16, 2013

Anyone can solve this?

@mhenrixon
Copy link

👍

@felixbuenemann
Copy link

I'm pretty sure there's no way to avoid this warning, because it comes from CoreText Framework code.

@ericboehs
Copy link

So is "Times New Roman" provided by you in the CSS? Or is it coming from phantomjs somewhere?

@felixbuenemann
Copy link

I've had the same warning with Arial, so I guess it depends on the font-family in the css.

@ericboehs
Copy link

I'm completely unfamiliar with Objective-C, but could you wrap the only line that calls CTFontCreateWithName with some pragma marks like this (replacing shadow-ivar with some performance/note code for the CTFont Suboptimal Request message) or something else that would eat the log messages?

@felixbuenemann
Copy link

@ericboehs It's a runbtime warning not compile time, so I don't think a pragma will help.

Maybe this helps (look at the snippet at the bottom): http://stackoverflow.com/questions/18291333/coretext-performance-warning-when-creating-a-ctfont

@ericboehs
Copy link

@ericboehs It's a runbtime warning not compile time, so I don't think a pragma will help.

Maybe this helps (look at the snippet at the bottom): http://stackoverflow.com/questions/18291333/coretext-performance-warning-when-creating-a-ctfont

Ah! Good find! So it looks like we have a solution, we just need someone wise enough to make a PR. (It'd take me hours to figure out the proper syntax, where it should go and how to compile.)

@felixbuenemann
Copy link

I think another solution would be to disable QT_MAC_USE_COCOA, not sure what effect that would have. But given that it's headless it shouldn't really matter what font engine we are using.

@sjhcockrell
Copy link

👍 Still seems to be an issue in OSX Mavericks v6.

@wagenet
Copy link

wagenet commented Oct 8, 2013

I can verify this is indeed an issue in Mavericks OS X 10.9 (13A598).

@JosephHalter
Copy link

👍

@Fjan
Copy link

Fjan commented Oct 23, 2013

This is a quick solution to avoid the annoying warnings, add this to your test_helper.rb:

  Capybara.register_driver :webkit do |app|
    Capybara::Webkit::Driver.new(app, stderr: WarningSuppressor)
  end

Capybara.default_driver = Capybara.javascript_driver = :webkit

class WarningSuppressor
  class << self
    def write(message)
      if message =~ /QFont::setPixelSize: Pixel size <= 0/ || message =~/CoreText performance note:/ then 0 else puts(message);1;end
    end
  end
end

Edit: sorry, this hack only works for the capybara/webkit combo, see solution for poltergeist by @ericboehs below

@octatone
Copy link

👍 Mavericks is officially out, can we get a fix on this, please?

@JamesMGreene
Copy link
Collaborator

@danielhusar
Copy link

+1

1 similar comment
@hangsu
Copy link

hangsu commented Oct 23, 2013

+1

@jondkinney
Copy link

I'm a little confused on how to proceed and resolve this issue... should I go monkey with qt4? Is this being addressed in phantomjs directly? Thanks!

@ericboehs
Copy link

As @felixbuenemann and I discussed earlier in this thread, I believe the fix is to do this to the line that calls CTFontCreateWithName. I'm just not familiar enough with Obj C to implement this.

As for the hack @Fjan recommended, that's a capybara webkit specific solution which won't work for poltergeist (or other drivers). I posted a solution for poltergeist (based on @Fjan's solution) in this gist.

@jondkinney
Copy link

@ericboehs gotcha, thanks. I was just confused when the issue was closed with seemingly no resolution. Sounds like a fix is outstanding then, and we'll have to wait for someone with Obj C chops to help out. I guess that work will be tracked in a separate github issue?

@ericboehs
Copy link

@jondkinney

Sounds like a fix is outstanding then, and we'll have to wait for someone with Obj C chops to help out

Yep

I guess that work will be tracked in a separate github issue?

I believe the issue is with with phantomjs and I don't see an open duplicate ticket, so this should be the place to collaborate on a solution.

@jondkinney
Copy link

I assumed so too. Perhaps I mistakenly thought this issue was closed based on the closed issues being referenced in the thread above that are not this specific issue. Sorry for the confusion!

@inelgnu
Copy link

inelgnu commented Oct 24, 2013

I have the same problem

phantomjs[4295:110b] CoreText performance note: Client called CTFontCreateWithName() using name "Helvetica Neue" and got font with PostScript name "HelveticaNeue". For best performance, only use PostScript names when calling this API.

@Nek
Copy link

Nek commented Oct 24, 2013

+1

I have the same message the only difference is the name of the font.

@jwg2s
Copy link

jwg2s commented Oct 24, 2013

+1 also getting this message after upgrade

@amerikan
Copy link

amerikan commented Jan 9, 2014

Awesome! Thanks for updating the bottle. 😄

@ryansch
Copy link

ryansch commented Jan 9, 2014

Actually it looks like homebrew is leveraging jenkins to automatically detect changes that need a new bottle. Very neat stuff.

@aprescott
Copy link

You can use brew update && brew reinstall phantomjs to get the fix.

@sikachu
Copy link

sikachu commented Jan 20, 2014

Note that you may need to pass in --build-from-source flag as well to force a recompile, otherwise it may pouring from bottle instead:

brew update && brew reinstall phantomjs --build-from-source

@janko
Copy link

janko commented Jan 21, 2014

@sikachu's way doesn't work for me (nor without --build-from-source). I still get the warning when I run it after the reinstallation :/

@ryansch
Copy link

ryansch commented Jan 22, 2014

@sikachu Homebrew has been updating the bottles automatically shortly after the pull request is applied to master. We merely have to wait for the bottle update commit from the build bot. No need to build from source.

@sikachu
Copy link

sikachu commented Jan 22, 2014

Was it? For some reason I got an unfixed bottle, so I had to built from source. That's a good news, then!

@ryansch
Copy link

ryansch commented Jan 22, 2014

The CoreText warning has been fixed. The userSpaceScaleFactor fix appears to have missed the mark. See my comment on #11612.

@janko
Copy link

janko commented Jan 22, 2014

Aha, yeah, I'm getting the userSpaceScaleFactor one. Thank you for looking into it :)

@tkuichooseyou
Copy link

I'm still getting the CoreText warning after I did a brew upgrade && brew reinstall phantomjs. I'm on Mavericks 10.9.1

@janko
Copy link

janko commented Feb 12, 2014

Above is said that you should brew resintall phantomjs --build-from-source.

@amerikan
Copy link

@tku90 Did you try brew update && brew upgrade phantomjs ?? It worked for me.

@tkuichooseyou
Copy link

@janko-m @erikmontes Yes I tried build-from-source as well, and brew reinstall upgraded to the latest version, so brew upgrade phantomjs tells me that it's up to date.

@janko
Copy link

janko commented Feb 12, 2014

And you're sure Homebrew didn't use an already downloaded version of PhantomJS (without the patch)? I know it's a stupid question, but I have to ask :)

@tkuichooseyou
Copy link

@janko-m Yep it's the latest version of PhantomJS installed (1.9.7)

@kylewelsby
Copy link

I can report this issue is fixed for Mavericks

PhantomJS version 1.9.7

 $ brew update && brew upgrade phantomjs
==> Upgrading 1 outdated package, with result:
phantomjs 1.9.7
==> Upgrading phantomjs
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/phantomjs-1.9.7.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring phantomjs-1.9.7.mavericks.bottle.tar.gz
:beer:  /usr/local/Cellar/phantomjs/1.9.7: 104 files, 34M
[  6:33pm ]  [ kyle@mekyle:~/Code/Sctrach/issue ]
 $ phantomjs --version
1.9.7
[  6:33pm ]  [ kyle@mekyle:~/Code/Sctrach/issue ]
 $ phantomjs issue.js
[debug] document Height: 1735
[debug] viewport Height: 768
[debug] {"left":492,"right":572,"top":1578,"height":55,"bottom":1633,"width":80}
[debug] https://www.google.com/search?q=cats&prmd=ivnsel&ei=-A_9UsW_NeOP7AakwYDIBw&start=10&sa=N

@tkuichooseyou
Copy link

Here's my terminal output:

~/r/w/healthfund git:master ❯❯❯ brew update && brew upgrade phantomjs                                                                                                           ✭
Already up-to-date.
Error: phantomjs-1.9.7 already installed
~/r/w/healthfund git:master ❯❯❯ rspec spec/features/*                                                                                                                         ⏎ ✭
...........2014-02-13 17:18:02.814 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.815 webkit_server[53244:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
2014-02-13 17:18:02.819 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.844 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.845 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.845 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.846 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.849 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.852 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.968 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.968 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:02.971 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:03.152 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:03.152 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2014-02-13 17:18:03.152 webkit_server[53244:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
.........

Finished in 9.48 seconds
20 examples, 0 failures

@janko
Copy link

janko commented Feb 14, 2014

Hmm, it shouldn't say "webkit_server", it should say "phantomjs". Are you sure you're using poltergeist, and not capybara-webkit?

@janko
Copy link

janko commented Feb 14, 2014

Try running phantomjs in the Terminal, and see if you're getting the warning. If you're not, then it isn't coming from phantomjs.

@tkuichooseyou
Copy link

That was it, sorry I should have caught that haha, thanks a lot!

@mustangore
Copy link

@kylewelsby Thanks for the hint! ;)

@indera
Copy link

indera commented Aug 22, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests