如何将正确的字体大小从 Photoshop 导入到 iOS 中
我有一个 psd 文件的设计。因此,我将所有文本属性(字体名称、大小(以 pt 为单位)、颜色等)复制到代码中并运行它。我做了一个屏幕截图并将其与设计进行了比较。 我想知道,为什么 iOS(就我而言)渲染的字体大小(以 pt 为单位)比 Photoshop 小?
pt 取决于屏幕分辨率吗?是否有一个辅助函数可以让我根据 px 大小来计算它?
I have a design in an psd file. So I copied all text properties (fontname, size (in pt), color, etc) into code and run it. I did a screenshot and compared that to the design.
I am wondering, why is iOS (in my case) rendering the font sizes (in pt) smaller than Photoshop does?
Does pt depend on the screen resolution? Is there maybe a helper function that I could calculate it from a px size?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为最简单的方法(不确定是否最准确)是从 Photoshop 获取像素值(而不是点值)并使用它们。假设您正在设计 320x480(非视网膜)的 Photoshop 文件,这应该可以很好且非常准确地工作。
这是一个示例,左边是在 Photoshop 中,大小为 12px,右边是在 iOS Simulator 中,大小为 12pt。
I think the easiest way (not sure if the most accurate one) would be to take pixel values (not point ones) from Photoshop and use those instead. Assuming you are designing Photoshop files that are 320x480 (not retina) this should work nicely and quite accurately.
Here's a sample, left is in Photoshop at size 12px and right is in iOS Simulator at 12pt.
您必须将文档分辨率更改为 144 像素/英寸,并保持屏幕宽度 640 像素(纵向)。
转到图像>图像尺寸>解决
You have to change document resolution to 144 pixels/Inch and keep screen width 640px (for portrait orientation).
Goto Image > Image Size > Resolution
Photoshop 拉蒂纳图像-12Pt = Ios-6Pt(X=2*Y)
Photoshop 不是 Ratina images-12pt = Ios-12pt(X=Y)
Photoshop ratina images-12Pt = Ios-6Pt(X=2*Y)
photoshop not ratina images-12pt = Ios-12pt(X=Y)