简体   繁体   English

对字体(OTF或TTF)有什么要求,以便在Android上运行良好?

[英]What are the requirements for a font (OTF or TTF) so it works well on Android?

I'm having have some issues with using a custom font ( Typeface ) in Android. 我在Android中使用自定义字体(字体)时遇到了一些问题。

What happens is that when rendering text in a TextView, the last line is often partially cut off vertically (the lower parts of letters like g, j, y, etc missing) , even if there's PLENTY of space below the text. 发生的事情是,在TextView中渲染文本时,最后一行通常会被部分垂直切断(字母的下半部分,如g,j,y等缺失),即使文本下方有大量空间。 I assume this is because there's something wrong with the custom font file ( an OTF file) that I'm using. 我认为这是因为我正在使用的自定义字体文件(OTF文件)有问题。 This does only happen when using this custom font. 这仅在使用此自定义字体时发生。 If I use Android standard fonts, not setting my custom typeface, everything works fine. 如果我使用Android标准字体,而不是设置我的自定义字体,一切正常。

Question: What are the requirements for font files for Android, so that they work correctly. 问题:Android的字体文件有哪些要求,以便它们正常工作。 (Please don't post workarounds for the issue, I'm aware of those. ) (请不要发布问题的解决方法,我知道这些。)

OTF和TTF字体都可以在android中正常工作,你必须处理文本化和填充它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM