mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
call Q_INIT_RESOURCE statically from Font constructor
This commit is contained in:
parent
6a58d8b0a3
commit
961b5b5346
1 changed files with 11 additions and 0 deletions
|
@ -88,6 +88,9 @@ const float DEFAULT_POINT_SIZE = 12;
|
||||||
|
|
||||||
class Font {
|
class Font {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Font();
|
||||||
|
|
||||||
using TexturePtr = QSharedPointer < QOpenGLTexture >;
|
using TexturePtr = QSharedPointer < QOpenGLTexture >;
|
||||||
using VertexArrayPtr = QSharedPointer< QOpenGLVertexArrayObject >;
|
using VertexArrayPtr = QSharedPointer< QOpenGLVertexArrayObject >;
|
||||||
using ProgramPtr = QSharedPointer < QOpenGLShaderProgram >;
|
using ProgramPtr = QSharedPointer < QOpenGLShaderProgram >;
|
||||||
|
@ -183,6 +186,14 @@ Font* loadFont(const QString& family) {
|
||||||
return LOADED_FONTS[family];
|
return LOADED_FONTS[family];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Font::Font() {
|
||||||
|
static bool fontResourceInitComplete = false;
|
||||||
|
if (!fontResourceInitComplete) {
|
||||||
|
Q_INIT_RESOURCE(font);
|
||||||
|
fontResourceInitComplete = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NERD RAGE: why doesn't QHash have a 'const T & operator[] const' member
|
// NERD RAGE: why doesn't QHash have a 'const T & operator[] const' member
|
||||||
const Glyph & Font::getGlyph(const QChar & c) const {
|
const Glyph & Font::getGlyph(const QChar & c) const {
|
||||||
if (!_glyphs.contains(c)) {
|
if (!_glyphs.contains(c)) {
|
||||||
|
|
Loading…
Reference in a new issue