mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-25 09:38:46 +02:00
Merge pull request #10664 from zfox23/FB5260_PotentialFontCrash
Potentially fix a crash in font loading
This commit is contained in:
commit
123ed81e20
2 changed files with 4 additions and 1 deletions
|
@ -14,6 +14,8 @@
|
||||||
#include "../RenderUtilsLogging.h"
|
#include "../RenderUtilsLogging.h"
|
||||||
#include "FontFamilies.h"
|
#include "FontFamilies.h"
|
||||||
|
|
||||||
|
static std::mutex fontMutex;
|
||||||
|
|
||||||
struct TextureVertex {
|
struct TextureVertex {
|
||||||
glm::vec2 pos;
|
glm::vec2 pos;
|
||||||
glm::vec2 tex;
|
glm::vec2 tex;
|
||||||
|
@ -56,6 +58,7 @@ Font::Pointer Font::load(QIODevice& fontFile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::Pointer Font::load(const QString& family) {
|
Font::Pointer Font::load(const QString& family) {
|
||||||
|
std::lock_guard<std::mutex> lock(fontMutex);
|
||||||
if (!LOADED_FONTS.contains(family)) {
|
if (!LOADED_FONTS.contains(family)) {
|
||||||
|
|
||||||
static const QString SDFF_COURIER_PRIME_FILENAME{ ":/CourierPrime.sdff" };
|
static const QString SDFF_COURIER_PRIME_FILENAME{ ":/CourierPrime.sdff" };
|
||||||
|
|
|
@ -31,10 +31,10 @@ public:
|
||||||
const glm::vec4* color, EffectType effectType,
|
const glm::vec4* color, EffectType effectType,
|
||||||
const glm::vec2& bound, bool layered = false);
|
const glm::vec2& bound, bool layered = false);
|
||||||
|
|
||||||
static Pointer load(QIODevice& fontFile);
|
|
||||||
static Pointer load(const QString& family);
|
static Pointer load(const QString& family);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static Pointer load(QIODevice& fontFile);
|
||||||
QStringList tokenizeForWrapping(const QString& str) const;
|
QStringList tokenizeForWrapping(const QString& str) const;
|
||||||
QStringList splitLines(const QString& str) const;
|
QStringList splitLines(const QString& str) const;
|
||||||
glm::vec2 computeTokenExtent(const QString& str) const;
|
glm::vec2 computeTokenExtent(const QString& str) const;
|
||||||
|
|
Loading…
Reference in a new issue