Paint.setTypeface 不适用于斜体,或者我做错了事情。我可以创建普通、粗体、等宽和衬线文本,但不能创建斜体文本。它总是看起来很正常(或者在粗斜体的情况下,它看起来很粗体)。
//This will appear monospace
paint.setTypeface(Typeface.MONOSPACE);
canvas.drawText("foo", 10, 10, paint);
//This will appear serif
paint.setTypeface(Typeface.SERIF);
canvas.drawText("foo", 10, 10, paint);
//This will appear bold
paint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
canvas.drawText("foo", 10, 10, paint);
//This will NOT appear italic <=== PROBLEM
paint.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC));
canvas.drawText("foo", 10, 10, paint);
// This isn't working either <=== PROBLEM
paint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC));
所以现在的问题是:是否有已知的解决方法?我的简单目标是用斜体画一些单词......