2

我有一种字体必须在我的应用程序中使用,但在小屏幕上看起来有点模糊,所以我想让它加粗。

我使用了这段代码:

font = FontFactory.createFromAsset(fontTextureAtlas, this, "Noteworthy.ttc", 20f, true, Color.BLUE);

但是没有选项没有使字体加粗,所以我尝试使用FontFactory.create()

    AssetManager mgr = AssetManager.class.newInstance();
        font = FontFactory.create(fontTextureAtlas,
                Typeface.create(Typeface.createFromAsset(mgr,"Noteworthy.ttc"),Typeface.BOLD),
                20f,
                true,
                Color.BLUE);

但我得到了这个:

ERROR/AndroidRuntime(2140): FATAL EXCEPTION: main
        java.lang.RuntimeException: native typeface cannot be made

而且我没有更多的想法如何使这种字体变粗。有人知道怎么做吗?

4

2 回答 2

1

I don't think that would be possible for one reason. If the font doesn't contain the information for bold it wont be able to show on screen. How fonts work is pretty much a blank sheet of paper and contains all letters at different level of weight and styles(e.g. italic, underline and bold). This may be a weight issue you are seeing as it is not meant for android phones (maybe internet or not fully customized for phone).

于 2012-08-02T13:28:07.360 回答
0

我找不到如何在 AndEngine 中使文本变为粗体,所以我只是从现有的字体中创建了新字体,只有粗体字母。

于 2012-09-11T10:36:04.633 回答