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
pull/8142/head
penguindark 2021-01-15 19:40:56 +01:00 committed by GitHub
parent c4c4b9c7b1
commit 1d1fda9522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 16 deletions

View File

@ -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 {