如何在 Android 上使用 Java 绘制特定字形?
我看过 http://docs。 oracle.com/javase/1.5.0/docs/api/java/awt/font/GlyphVector.html 但我不知道如何使用它在屏幕上显示字形。假设您想要在屏幕上打印字形编号 1042(每种字体可能不同,不太可能(但有可能)与 Unicode 1042 相同)。如何从数字转变成屏幕上的角色? GlyphVector 是可行的方法还是有更好的方法?
I have seen http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/font/GlyphVector.html but I don't know how you would use it to display a glyph on the screen. Lets say you want to print glyph number 1042 (likely to be different in each font and unlikely (but possible) to be the same as Unicode 1042) to the screen. How do you go from the number to the character on screen? Is GlyphVector the way to go or is there a better method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该 GlyphVector 类在 Android 上不可用。 Android 图形中似乎没有任何公共 API 调用允许在不通过 Unicode 编码的情况下访问字体字形。
您明显的选择似乎是直接解析 TrueType 字体文件。也许在某个地方找到一些已经移植到 Android 的库,或者可以这样移植(Freetype?)。
That GlyphVector class is not available on Android. There don’t seem to be any public API calls in Android graphics that allow access to font glyphs without going through the Unicode encoding.
Your obvious option would seem to be direct parsing of the TrueType font file. Perhaps find some library somewhere that has been ported to Android, or could be so ported (Freetype?).