freetype: max_width

pull/3513/head
Alexander Medvednikov 2020-01-20 05:14:49 +01:00
parent 53b06048d2
commit d1664dc511
1 changed files with 6 additions and 0 deletions

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)