两种不同分辨率的缩放比例
我有两种不同的分辨率,原始分辨率是567x756(宽X高),我要显示的分辨率是768x1024(宽X高)。如何找出这两种分辨率的缩放比例?例如,如果 567x756 分辨率中使用的字体大小为 7 pts,那么我应该将什么值乘以字体大小(7 pts)才能以 768x1024 分辨率显示文本。
I have two different resolutions, the original one is 567x756 (wXh), the one which I want to display is 768x1024 (wXh). How to find out the scaling ratio for these two resolutions? For example if the font size used in 567x756 resolution is 7 pts then what's the values I should multiply with the font size (7 pts) to display the text in 768x1024 resolution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每当您听到“缩放”时,请想到“比例”:
您可以在此处设置比例:
因此,您的新字体约为 9.48,如果您只需要整数,则为 9。
或者,您也可以在计算中使用高度与高度的比例,而不是宽度与宽度的比例。或者使用您通过执行任一操作获得的平均字体高度。或者执行 old_area/old_font^2 = new_area/new_font^2
如果您想要一种方法来找到任意新宽度的缩放因子:
给定您的新 w (或 h,或 w/e),新字体大小为 (7 /567) * w
Whenever you hear "scaling", think "proportions":
You can set up a proportion, here:
So your new font is about 9.48, or 9 if you only want integers.
Alternatively, you could also use the height-to-height proportion in your calculations instead of width-to-width. Or use the average font height you'd get from doing either. Or do old_area/old_font^2 = new_area/new_font^2
If you want a way to find the scaling factor for any arbitrary new width:
Given your new w (or h, or w/e), the new font size is (7/567) * w
两种分辨率的长宽比相同,因此只需取一维并将其用作缩放比,即
大约 1.35。或者如果你想在另一个方向缩放,0.738
The aspect ratios are the same for both resolutions, so just take one dimension and use that as your scaling ratio, i.e.
Which is about 1.35. Or if you want to scale in the other direction, 0.738