1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

freetype: max_width

This commit is contained in:
Alexander Medvednikov 2020-01-20 05:14:49 +01:00
parent 53b06048d2
commit d1664dc511

View File

@ -367,6 +367,12 @@ fn (ctx mut FreeType) private_draw_text(_x, _y int, utext ustring, cfg gx.TextCf
// Render quad
gl.draw_arrays(C.GL_TRIANGLES, 0, 6)
x += f32(ch.horizontal_advance_px)
// Stop drawing if the limit is reached
if cfg.max_width > 0 {
if x >= cfg.max_width {
break
}
}
}
gl.bind_vao(u32(0))
C.glBindTexture(C.GL_TEXTURE_2D, 0)