Skip to content

Commit e538015

Browse files
committed
TextRendering.cpp small refactor
1 parent 9ae792d commit e538015

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/nbl/ext/TextRendering/TextRendering.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ core::smart_refctd_ptr<ICPUImage> FontFace::generateGlyphMSDF(uint32_t baseMSDFP
119119
// and we can't deep clone it
120120
auto shape = generateGlyphShape(glyphId);
121121

122-
// Empty shapes should've been filtered sooner
123-
assert(!shape.contours.empty());
124-
125122
uint32_t mipW = textureExtents.x / (1 << i);
126123
uint32_t mipH = textureExtents.y / (1 << i);
127124

@@ -136,6 +133,12 @@ core::smart_refctd_ptr<ICPUImage> FontFace::generateGlyphMSDF(uint32_t baseMSDFP
136133
region.imageOffset = { 0u,0u,0u };
137134
region.imageExtent = { mipW, mipH, 1u };
138135

136+
if (shape.contours.empty())
137+
{
138+
_NBL_DEBUG_BREAK_IF(true); // glyph id has no contours in it's shape for this font
139+
continue;
140+
}
141+
139142
auto shapeBounds = shape.getBounds();
140143

141144
float32_t2 mipExtents = float32_t2(float(mipW), float(mipH));
@@ -166,7 +169,7 @@ core::smart_refctd_ptr<ICPUImage> FontFace::generateGlyphMSDF(uint32_t baseMSDFP
166169
assert(bufferOffset <= buffer->getCreationParams().size);
167170
image->setBufferAndRegions(std::move(buffer), std::move(regions));
168171

169-
return std::move(image);
172+
return image;
170173
}
171174

172175
float32_t2 FontFace::getUV(float32_t2 uv, float32_t2 glyphSize, uint32_t2 textureExtents, uint32_t msdfPixelRange)

0 commit comments

Comments
 (0)