freetype: fix align.right rendering

pull/3484/head
Alexander Medvednikov 2020-01-16 17:03:31 +01:00
parent 1e98a227cc
commit 756c6d2858
3 changed files with 10 additions and 9 deletions

View File

@ -665,11 +665,11 @@ fn (p mut Parser) check_unused_and_mut_vars() {
break
}
if !var.is_used && !p.pref.is_repl && !var.is_arg && !p.pref.translated &&
var.name != 'tmpl_res' && p.mod != 'vweb' && var.name != 'it' {
var.name != 'tmpl_res' && p.mod != 'vweb' && var.name != 'it' && !p.cur_fn.is_unsafe {
p.production_error_with_token_index('`$var.name` declared and not used', var.token_idx)
}
if !var.is_changed && var.is_mut && !p.pref.is_repl && !p.pref.translated && var.typ != 'T*' && p.mod != 'ui' && var.typ != 'App*' {
p.warn_or_error('`$var.name` is declared as mutable, but it was never changed')
//p.warn_or_error('`$var.name` is declared as mutable, but it was never changed')
}
}
}

View File

@ -310,7 +310,7 @@ fn build_thirdparty_obj_file_with_msvc(path string, moduleflags []CFlag) {
mut obj_path := '${path}bj'
obj_path = os.realpath(obj_path)
if os.exists(obj_path) {
println('$obj_path already build.')
println('$obj_path already built.')
return
}
println('$obj_path not found, building it (with msvc)...')

View File

@ -262,7 +262,8 @@ fn (ctx mut FreeType) private_draw_text(_x, _y int, utext ustring, cfg gx.TextCf
mut y := f32(_y)
// println('scale=$ctx.scale size=$cfg.size')
if cfg.align == gx.ALIGN_RIGHT {
width := utext.len * 7
//width := utext.len * 7
width := ctx.text_width(utext.s)
x -= width + 10
}
x *= ctx.scale// f32(2)