Reputation: 55615
How do I set the font characteristics before calling rsgDrawText? I'm specifically interested in being able to set the font size.
Upvotes: 1
Views: 231
Reputation: 1469
Its a multi-part process. In the file you use to control the RenderScript runtime (the one which owns the script usually) do the following after initializing the script but before binding it:
Font mFontSans; //This can be a class member variable.
private void initFonts() {
// Sans font by family name
mFontSans = Font.create(mRS, mRes, "sans-serif", Font.Style.NORMAL, 8);
mScript.set_gFontSans(mFontSans);
}
Then in the RenderScript file have a global variable (in this case gFontSans) and call:
rsgBindFont(gFontSans);
Sometime before you draw the text you want. If you need different sizes you need to have them stored as separate variables, or an array.
Upvotes: 2