Using core text on Mac book pro / HD screen different text sizes

微笑、不失礼 提交于 2019-12-08 05:57:41

问题


I've recently shifted to a MacBook Pro 15" and core text is behaving strangely.

I have an app that uses core text to draw an NSattributedstring with CTFrameDraw. It works as expected on the external 1080p monitor, if I drag the window across to the MacBook Pro screen then the font is displayed very tiny like it's changed from 10 point font to 5 point when painted. Likewise if I repaint the text on the MacBook Pro then it's still small.

I'd guess it's because the MacBook Pro has the high resolution screen, and the font is being rendered to the native pixel resolution. Could anyone point me to docs on how to handle this? I had a google around and came up empty.

Swift 3, Xcode 8.2.1 on OSX 10.12.2

tia


回答1:


It was me. I had this bit of code

var c = context.ctm
c = c.inverted()
context.concatenate(c)

to set the transformation matrix back to the identity. It screws things up on the double pixel displays.



来源:https://stackoverflow.com/questions/42002222/using-core-text-on-mac-book-pro-hd-screen-different-text-sizes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!