This commit is contained in:
DBotThePony 2023-09-23 12:20:46 +07:00
parent 4a1a26a493
commit 1479f7483a
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -212,19 +212,23 @@ class Font(
model.translate(x = -lineWidth - movedX, y = lineHeight) model.translate(x = -lineWidth - movedX, y = lineHeight)
} }
client.programs.font.use() builder.end()
client.programs.font.colorMultiplier = color
client.programs.font.worldMatrix = client.stack.last()
builder.upload(vbo, ebo, GL_STREAM_DRAW) if (builder.elementCount != 0) {
client.programs.font.use()
client.programs.font.colorMultiplier = color
client.programs.font.worldMatrix = client.stack.last()
client.activeTexture = 0 builder.upload(vbo, ebo, GL_STREAM_DRAW)
atlas.bind()
client.vao = vao client.activeTexture = 0
glDrawElements(GL_TRIANGLES, builder.indexCount, builder.indexType, 0L) atlas.bind()
checkForGLError()
client.vao = null client.vao = vao
glDrawElements(GL_TRIANGLES, builder.indexCount, builder.indexType, 0L)
checkForGLError()
client.vao = null
}
return TextSize(totalX * scale, totalY * scale) return TextSize(totalX * scale, totalY * scale)
} }
@ -261,10 +265,8 @@ class Font(
if (chr == '\t') { if (chr == '\t') {
if (lineGlyphs % 4 == 0) { if (lineGlyphs % 4 == 0) {
lineWidth += space.advanceX * 4 lineWidth += space.advanceX * 4
client.stack.last().translate(x = space.advanceX * 4)
} else { } else {
lineWidth += space.advanceX * (lineGlyphs % 4) lineWidth += space.advanceX * (lineGlyphs % 4)
client.stack.last().translate(x = space.advanceX * (lineGlyphs % 4))
} }
lineGlyphs += lineGlyphs % 4 lineGlyphs += lineGlyphs % 4