1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg: some stuff required to have svg and png screenshots working on v ui (#14180)

This commit is contained in:
R cqls
2022-04-26 19:59:36 +02:00
committed by GitHub
parent be513b4c27
commit c26b7666c7
4 changed files with 30 additions and 6 deletions

View File

@@ -59,13 +59,13 @@ pub fn (mut bmp BitMap) clear() {
}
// transform matrix applied to the text
fn (bmp &BitMap) trf_txt(p &Point) (int, int) {
pub fn (bmp &BitMap) trf_txt(p &Point) (int, int) {
return int(p.x * bmp.tr_matrix[0] + p.y * bmp.tr_matrix[3] + bmp.tr_matrix[6]), int(
p.x * bmp.tr_matrix[1] + p.y * bmp.tr_matrix[4] + bmp.tr_matrix[7])
}
// transform matrix applied to the char
fn (bmp &BitMap) trf_ch(p &Point) (int, int) {
pub fn (bmp &BitMap) trf_ch(p &Point) (int, int) {
return int(p.x * bmp.ch_matrix[0] + p.y * bmp.ch_matrix[3] + bmp.ch_matrix[6]), int(
p.x * bmp.ch_matrix[1] + p.y * bmp.ch_matrix[4] + bmp.ch_matrix[7])
}

View File

@@ -20,7 +20,7 @@ pub struct Text_block {
cut_lines bool = true // force to cut the line if the length is over the text block width
}
fn (mut dev BitMap) get_justify_space_cw(txt string, w int, block_w int, space_cw int) f32 {
pub fn (mut dev BitMap) get_justify_space_cw(txt string, w int, block_w int, space_cw int) f32 {
num_spaces := txt.count(' ')
if num_spaces < 1 {
return 0

View File

@@ -771,7 +771,7 @@ fn (mut tf TTF_File) read_cmap(offset u32) {
* CMAPS 0/4
*
******************************************************************************/
fn (mut tf TTF_File) map_code(char_code int) u16 {
pub fn (mut tf TTF_File) map_code(char_code int) u16 {
mut index := 0
for i in 0 .. tf.cmaps.len {
mut cmap := tf.cmaps[i]
@@ -1006,13 +1006,13 @@ fn (mut tf TTF_File) read_kern_table() {
}
}
fn (mut tf TTF_File) reset_kern() {
pub fn (mut tf TTF_File) reset_kern() {
for i in 0 .. tf.kern.len {
tf.kern[i].reset()
}
}
fn (mut tf TTF_File) next_kern(glyph_index int) (int, int) {
pub fn (mut tf TTF_File) next_kern(glyph_index int) (int, int) {
mut x := 0
mut y := 0
for i in 0 .. tf.kern.len {