What would be the best way to rasterize or render a font to some kind of image or array with QT
Moved
Unsolved
General and Desktop
-
So what I want to do is to be able to write text to something that I can feed into OpenGL and then do transformations on. The thing is that I don't want to do this with OpenGL because I want to interact with it which would make messy code. I don't want to make sprite sheets because there could be limitations to this. Size and number of fonts and that I would like to be able to load them from byte arrays. I have looked for information on this stuff and only found 2 places that explain this stuff and both of them aren't very clear. Do you have to sell your soul to learn this?
-
@AI_Messiah
the simplest way is probably to use a QPainter on an QImageint main(int argc, char *argv[]) { QApplication app(argc, argv); QImage img(500,500, QImage::Format_RGB32); img.fill(Qt::white); QPainter p(&img); p.drawText(QRect(0,0, 500,500), "HelloWorld"); //To simply show the painted image QLabel l; l.resize(500,500); l.show(); l.setPixmap(QPixmap::fromImage(img)); return app.exec(); }