Android uses canvas to draw text on pictures
[Android] some settings of paint font, thickness and other attributes in Android
Typeface class is used to define fonts in Android SDK, which can be set by common font type names, such as setting default bold:
Common font type names include:
*Typeface.default / / general font type
* Typeface.DEFAULT_ Bold / / bold font type
*Typeface.monospace / / equal width font type
* Typeface.SANS_ Serif / / sans serif font type
*Typeface.serif / / serif font type
In addition to the font type settings, you can also set the font style for the font type, such as setting bold:
Common font style names include:
*Typeface.bold / / bold
* Typeface.BOLD_ Italic / / Bold Italic
*Typeface.italic / / Italic
*Typeface.normal / / General
However, sometimes the above settings do not work during drawing, so the following settings are available:
Other methods commonly used by paint are:
Note: for the setting of Chinese bold, it seems that it can only be realized through setfakeboldtext (true), although the effect seems not very real (font hollow effect). It is found that the final drawing effect is also related to the mobile phone hardware, such as the previous drawing test program
A small application that draws text on a picture. The following is the method of drawing text, which can automatically wrap lines and automatically adapt the font to the screen size
The above article on how Android uses canvas to draw text on pictures is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.