是Android 5.0(API 21),将无法呈现自定义字体/字体 [英] Android 5.0 (API 21) fails to render custom fonts / typefaces

查看:219
本文介绍了是Android 5.0(API 21),将无法呈现自定义字体/字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是Android 5.0似乎有麻烦呈现自定义字体。此问题不会出现pre的是Android 5.0,它不会是Android 5.1(API 22)出现。下面是使用一个被称为过山车字型的例子,可在这里: http://www.dafont.com/ coaster.font

Android 5.0 seems to have trouble rendering custom fonts. This issue does not occur pre Android 5.0 and it does not occur in Android 5.1 (API 22). Here is an example using a font called "coaster", available here: http://www.dafont.com/coaster.font

21 API:

API 21:

22 API:

API 22:

对于做任何解释?

推荐答案

谷歌已经承认这是Android的5.0的问题,并在搭载Android 5.1固定它:<一href=\"https://$c$c.google.com/p/android-developer-$p$pview/issues/detail?id=608&thanks=608&ts=1404735239\" rel=\"nofollow\">https://$c$c.google.com/p/android-developer-$p$pview/issues/detail?id=608&thanks=608&ts=1404735239

Google has acknowledged that this was an issue in Android 5.0, and has fixed it in Android 5.1: https://code.google.com/p/android-developer-preview/issues/detail?id=608&thanks=608&ts=1404735239

至于让自定义字体在Android 5.0的工作,还有在我联系到上述问题页面推荐的变通。这是对这个问题后#16。您需要将您的TTF字体文件到TTX,然后将其从TTX转换为TTF。您可以使用此工具来做到这一点: https://github.com/behdad/fonttools/

As for getting custom fonts to work on Android 5.0, there is a recommended work around in the issue page that I linked to above. It is post #16 on the issue. You need to convert your TTF font file to TTX and then convert it from TTX to TTF. You can use this tool to do so: https://github.com/behdad/fonttools/

我发现这些指南是有帮助的设立fonttools:

I found these guides to be helpful for setting up fonttools:

Windows系统: http://glyphrstudio.com/ttx/

Windows: http://glyphrstudio.com/ttx/

OSX: http://www.fontgeek.net/blog/?p=435

之后,在终端或命令提示符下浏览到您的TTF文件所在的目录,然后运行命令:

After installed, in terminal or the command prompt navigate to the directory where your TTF file is and run the command:

ttx font_file.ttf

在哪里font_file是你的,好了,字体文件的名称。这将输出目录中的文件font_file.ttx您当前所在然后在这个新的font_file.ttx文件,只需运行命令:

Where "font_file" is the name of your, well, font file. This will output a font_file.ttx file in the directory you are currently in. Then, on this new font_file.ttx file, simply run the command:

ttx font_file.ttx

这将输出的字体的新TTF文件,并​​且你可以使用这个在你的Andr​​oid项目。这些步骤为我工作。

This will output a new TTF file of your font, and you can use this one in your Android project. These steps worked for me.

这篇关于是Android 5.0(API 21),将无法呈现自定义字体/字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆