#includeint main() { // Load font file Font font("arial.ttf"); // Create a new image Image image(640, 480); // Create a new text object Text text("Hello, world!", &font, 24); // Draw the text on the image image.draw_text(text, 100, 100); // Save the image image.save("text.png"); }
#includeThe Font library is a part of the SFML library package in C++ programming.int main() { // Load font file Font font("arial.ttf"); // Set font color and size font.set_color(Color::white); font.set_size(36); // Set background color Color bg_color(100, 100, 100); font.set_background(bg_color); // Create a new text object Text text("Hello, world!", &font); // Draw the text on the image Image image = text.draw(); // Save the image image.save("text.png"); }