freetype: max_width
parent
53b06048d2
commit
d1664dc511
|
@ -367,6 +367,12 @@ fn (ctx mut FreeType) private_draw_text(_x, _y int, utext ustring, cfg gx.TextCf
|
||||||
// Render quad
|
// Render quad
|
||||||
gl.draw_arrays(C.GL_TRIANGLES, 0, 6)
|
gl.draw_arrays(C.GL_TRIANGLES, 0, 6)
|
||||||
x += f32(ch.horizontal_advance_px)
|
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))
|
gl.bind_vao(u32(0))
|
||||||
C.glBindTexture(C.GL_TEXTURE_2D, 0)
|
C.glBindTexture(C.GL_TEXTURE_2D, 0)
|
||||||
|
|
Loading…
Reference in New Issue