在Mac book pro/HD屏幕上使用不同文本大小的核心文本 [英] Using core text on Mac book pro / HD screen different text sizes

查看:100
本文介绍了在Mac book pro/HD屏幕上使用不同文本大小的核心文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近转移到了MacBook Pro 15上,并且核心文字的表现异常.

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

我有一个使用核心文本通过CTFrameDraw绘制NSattributedstring的应用程序.它可以在外部1080p显示器上按预期工作,如果我将窗口拖到MacBook Pro屏幕上,则字体显示得非常小,就像在绘制时从10点字体更改为5点一样.同样,如果我在MacBook Pro上重新绘制文字,那么它仍然很小.

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.

我猜这是因为MacBook Pro具有高分辨率屏幕,并且字体被渲染为原始像素分辨率.谁能指出我有关如何处理此问题的文档?我周围有一个Google,却空了.

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,OSX 10.12.2上的Xcode 8.2.1

Swift 3, Xcode 8.2.1 on OSX 10.12.2

tia

推荐答案

是我.我有这段代码

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.

这篇关于在Mac book pro/HD屏幕上使用不同文本大小的核心文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆