How do I draw bold text on a Bitmap?
Use the setTypeface
method on your Paint
object to set the font to something with the bold style turned on.
paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
For Custom Fonts:
Typeface typeface = Typeface.create(Typeface.createFromAsset(mContext.getAssets(), "fonts/bangla/bensen_handwriting.ttf"), Typeface.BOLD);
For Normal Fonts:
Typeface typeface = Typeface.create(Typeface.DEFAULT, Typeface.BOLD);// orTypeface typeface = Typeface.DEFAULT_BOLD;
and then
paint.setTypeface(typeface);
Kotlin syntax to setup Paint for bold text
paint = Paint(Paint.ANTI_ALIAS_FLAG).also { it.typeface = Typeface.DEFAULT_BOLD }