-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Design a Text object that allows you to set its size, color, and value. Its most important feature is to retrieve the text width and height so that developers can check whether they fit in a given region. For example, the feature allows you to check whether the text could fit inside a box of a given height and width.
A possible solution would be to create an image object, drawtext on it, then retrieve the objects resulting width and height as described here. The suggested code is shown below for reference:
CImg<unsigned char> imgtext;
unsigned char color = 1;
imgtext.draw_text(0,0,"Hello guys !",&color,0,1,23); // Draw with font height 23.
// Now, imgtext.width() and imgtext.height() gives you the dimensions you want.Metadata
Metadata
Assignees
Labels
No labels