Android的 - 结合多种字体样式,到一个单一的字体(字体) [英] Android - Combining multiple font styles, into one single font (Typeface)

查看:150
本文介绍了Android的 - 结合多种字体样式,到一个单一的字体(字体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个字体,不同的风格,可以说:MyFont_default.otf,MyFont_italic.otf,MyFont_bold.otf

I have several fonts with different styles, lets say: "MyFont_default.otf", "MyFont_italic.otf", "MyFont_bold.otf"

通常情况下,我会设置这样一个TextView的字体:

Normally, I would set the font of a TextView like this:

Typeface tf=Typeface.createFromAsset(context.getAssets(), "MyFont_italic.otf");
textView.setTypeface(tf);

和我的问题是:是否有可能所有这些字体,合并成一个单一的字体,说MyFont,并根据在XML布局文件(斜体,粗体)中定义的TextView的风格,要显示的TextView的在合适的字体?

And my question is: is it possible to combine all these fonts, into one single font, say "MyFont", and depending of the TextView style defined in the XML layout file (italic, bold), the TextView to be displayed in the appropriate font?

推荐答案

使用某种字体​​编辑器的字体结合成一个文件。许多字体,配有多种样式在一个单一的文件,它是什么,你会需要在这种情况下。

Use some sort of font editor to combine the fonts into a single file. Many fonts come with multiple styles in a single file, which is what you would need in this case.

这篇关于Android的 - 结合多种字体样式,到一个单一的字体(字体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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