Android/iPhone设备如何实现文本缩放?
简单的问题 - 在 Android/iPhone 设备上如何实现文本缩放?他们是否预先计算常用的字体位图并在比例变化时替换文本?或者他们从字体文件中提取轮廓并将文本渲染为矢量图形?
Simple question - how is text-zooming implemented on an Android/iPhone device? Do they pre-compute frequently used bitmaps of a font and replace the text as the scale changes? Or do they extract the contours from the font files and render the text as vector graphics?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文本渲染是一个相当复杂的主题,因此这里的任何答案都只是掩盖了很多内容。字体通常以矢量格式存储,而不是位图。系统通过计算每个字母的度量来布局文本,并创建一个矢量形状,该矢量形状将呈现为显示在屏幕上的位图。由于抗锯齿和子像素渲染的工作方式,系统不太可能将各个字母形式缓存为位图。但在某些时候,所有矢量图形都会转换为位图,因为典型的计算机显示是由像素组成的。
Text rendering is a fairly complex subject so any answer here will just be glossing over a lot of stuff. Typefaces are generally stored in vector format, and not bitmaps. The system lays out the text by computing the metrics of each letter and creates a vector shape that is rendered into a bitmap that is displayed on the screen. It's unlikely that the system will cache the individual letterforms as bitmaps because of the way antialiasing and subpixel rendering works. But at some point all vector graphics are converted into bitmaps because the typical computer display is made up of pixels.