字体口径有轻,轻意大利,意大利,常规,粗体和博尔德意大利版本。
使用示例:Font font = new Font("Calibre", type, 48);
要使用意大利语,我必须使用type = Font.ITALIC
要使用卡布里博尔德,我必须使用type = Font.BOLD
要使用type = Font.TRUETYPE_FONT规则,我必须使用
但是我怎样才能使用轻,轻意大利和粗体意大利版本?
发布于 2018-05-25 04:03:32
我想你可以用杯光字体:
Font font = new Font("Calibre Light", Font.ITALIC, 48);或者您可以加载字体,下面将加载杯光意大利
Font font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(
new File("calibrili.ttf"))).deriveFont(Font.PLAIN, 48);当然,上面的代码行需要包装在一个FileNotFoundException,FontFormatException,/catch块中,因为可能会引发异常和IOException。
Calibri是Microsoft,它打包了6个字体文件,它们是:
calibri.ttf The Standard Calibri font
calibrib.ttf Calibri Bold
calibrii.ttf Calibri Italic
calibril.ttf Calibri Light
calibrili.ttf Calibri Light Italic
calibriz.ttf Calibri Bold Italic您将注意到,使用字体类型的Font.ITALIC实际上什么也不做,因为杯光意大利是一种意大利字体。然而,Font.BOLD将粗体显示斜体文本。
发布于 2018-05-25 04:12:35
安卓studio.Here中的定制字体也是类似的问题。它应该适用于你,code for custom font in android studio
https://stackoverflow.com/questions/50519975
复制相似问题