mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
x.ttf: fix for the MSVC get_string
pointer issue (#8139)
* fix tab and spaces in indentation * fix for glyph not found error * fix for get_String in ttf.v pointer problems with MSVC * avoid second return in get_string * move from u32 to u64 to byteptr in 64 bit systems
This commit is contained in:
@ -557,25 +557,10 @@ fn (mut tf TTF_File) get_fixed() f32 {
|
||||
return f32(tf.get_i32() / f32(1 << 16))
|
||||
}
|
||||
|
||||
/*---- restore when MSVC will work again! ----
|
||||
fn (mut tf TTF_File) get_string(length int) string {
|
||||
tmp_pos := tf.pos
|
||||
tf.pos += u32(length)
|
||||
unsafe{
|
||||
return tos(&tf.buf.data[tmp_pos], length)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
fn (mut tf TTF_File) get_string(length int) string {
|
||||
tmp_pos := tf.pos
|
||||
mut tmp_txt := strings.new_builder(length)
|
||||
for _ in 0..length {
|
||||
tmp_txt.write_b(tf.get_u8())
|
||||
}
|
||||
res_txt := tmp_txt.str()
|
||||
tf.pos = tmp_pos + u32(length)
|
||||
return res_txt
|
||||
return unsafe{ tos(byteptr(u64(tf.buf.data)+u64(tmp_pos)), length) }
|
||||
}
|
||||
|
||||
fn (mut tf TTF_File) get_unicode_string(length int) string {
|
||||
|
Reference in New Issue
Block a user