如何加载大小超过 60kb 的自定义字体 (ttf)
我想加载大小为 150kb 的自定义字体,但出现 EXCEEDS_LIMIT 错误,并且在控制台下面打印“EXCEEDS_LIMIT”的代码中,我尝试减小 ttf 大小,但失败了 有什么想法吗?
LabelField helloWorld = new LabelField("Hello World");
int res = FontManager.getInstance().load("PageD1.TTf", "MyFont",
FontManager.EXCEEDS_LIMIT);
if (res == FontManager.SUCCESS) {
try {
FontFamily family = FontFamily.forName("MyFont");
Font myFont = family.getFont(Font.PLAIN, 50);
helloWorld.setFont(myFont);
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
} else if (res == FontManager.EXCEEDS_LIMIT) {
System.out.println("EXCEEDS_LIMIT");
}
add(helloWorld);
I want to load custom font with size 150kb, but I it gets EXCEEDS_LIMIT error and in the code that below console prints "EXCEEDS_LIMIT", I tried to reduce the ttf size but I failed
Any Idea??
LabelField helloWorld = new LabelField("Hello World");
int res = FontManager.getInstance().load("PageD1.TTf", "MyFont",
FontManager.EXCEEDS_LIMIT);
if (res == FontManager.SUCCESS) {
try {
FontFamily family = FontFamily.forName("MyFont");
Font myFont = family.getFont(Font.PLAIN, 50);
helloWorld.setFont(myFont);
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
} else if (res == FontManager.EXCEEDS_LIMIT) {
System.out.println("EXCEEDS_LIMIT");
}
add(helloWorld);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档< /a> OS 5.0 有 60kb 的限制。没有办法解决这个问题。
在 OS 6.0 下,限制保持不变,但在 7.0 下,限制提高到 6MB
According to the documentation there is a limit in place of 60kb for OS 5.0. There is no way to work around this.
Under OS 6.0 the limit remains the same, but under 7.0 it is raised to 6MB