iPhone:渲染文本与刻录成图像
这可能更像是一个哲学问题,但是在图像上方呈现文本时是否有令人信服的理由采取这种方式或另一种方式: 1.在服务器端将文字烧成图片,只在iphone上显示图片 或者 2. 将背景图像和文本分别发送到iPhone,并让iPhone 在图像上渲染文本。 显然,在 iPhone 中渲染文本需要更多工作(需要字体、颜色、大小来配合文本)。另外,文本可能无法准确呈现在其预期位置。但您确实可以获得原生字体和更清晰的缩放效果。 有什么意见吗? 谢谢。 -麦克风
This might be more of a philosophical question, but is there a compelling reason to go one way or the other when presenting text above an image:
1. Burn the text into the image on the server side and just show the image on the iphone
or
2. Send the background image and the text separately to the iphone and have the iphone render the text over the image.
Obviously it's more work in the iphone to render the text (would need font, color, size to accompany the text). Plus the text may not render exactly where it was intended. But you do get native fonts and sharper zooming.
Any opinions?
Thanks.
-Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我看来,这并不是一个足够具体的问题,无法有一个正确的答案。如果可行的话,我可能会假设您应该将文本渲染到客户端而不是服务器上的图像上。您牺牲了一致性,但允许用户选择更大的字体(如果他们喜欢)。您还可以在图像流入时立即显示文本。根据您的应用程序的不同,允许文本变化也可能是明智的,例如翻译或不同时间段的数据等。在客户端上渲染文本时,您可以缓存该图像的单个通用版本,然后切换到以瑞典语或其他方式显示 1931 年的犯罪率,而无需下载新图像。
It's not really a specific enough question to have a single right answer, IMO. If practical, I'd probably assume you should render text onto the image on the client instead of the server. You sacrifice consistency, but you allow the user to select a larger font if they prefer it. You also get the ability to show your text immediately while your images stream in. Depending on what your application is, it also might be sensible to allow variations on the text, such as translations, or data from a different time period, etc. By rendering the text on the client, you can cache a single, universal version of the image, and then switch to showing the crime rate in 1931 in Swedish, or whatever, without having to download a new image.
在服务器上渲染和缓存图像会将工作负载转移到服务器上,但肯定对客户端更加友好。此外,通过这种方式,双方都可以通过重用缓存的图像获得更大的好处。
Rendering and caching the image on the server would move the load of the work to the server, but would certainly be more client-friendly. This way, additionally, there is a greater benefit on BOTH sides from reusing cached images.