From 0dd0d07466aa2c88018f2929ab8a338bb4f1d378 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Mon, 9 Sep 2024 13:38:55 -0700 Subject: [PATCH] fix text debug assert on invalid or unloaded font --- .../entities-renderer/src/RenderableTextEntityItem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp index e6b42db0db..9aec4c47f1 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp @@ -367,7 +367,11 @@ void entities::TextPayload::render(RenderArgs* args) { transform.setRotation(BillboardModeHelpers::getBillboardRotation(transform.getTranslation(), transform.getRotation(), textRenderable->_billboardMode, usePrimaryFrustum ? BillboardModeHelpers::getPrimaryViewFrustumPosition() : args->getViewFrustum().getPosition())); - float scale = textRenderable->_lineHeight / textRenderer->getFontHeight(); + float scale = 1.0f; + float fontHeight = textRenderer->getFontHeight(); + if (fontHeight > 0.0f) { + scale = textRenderable->_lineHeight / fontHeight; + } transform.postTranslate(glm::vec3(-0.5, 0.5, 1.0f + EPSILON / dimensions.z)); transform.setScale(scale); batch.setModelTransform(transform);