mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
gg: text_width()
This commit is contained in:
@@ -85,9 +85,14 @@ pub fn (ft &FT) flush(){
|
|||||||
sfons.flush(ft.fons)
|
sfons.flush(ft.fons)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (ft &Context) text_width(s string) int {
|
pub fn (ctx &Context) text_width(s string) int {
|
||||||
|
if !ctx.font_inited {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
mut buf := [4]f32
|
||||||
|
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
|
||||||
|
return int((buf[2] - buf[0]) / ctx.scale)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn (ft &Context) text_height(s string) int {
|
pub fn (ft &Context) text_height(s string) int {
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user