mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
gg: fix ./v -gc none -autofree run examples/tetris/
(avoid return s1 + s2 + s3
, clone the arrays, passed to the fontstash wrapper)
This commit is contained in:
parent
331178b23b
commit
16a6e45274
@ -51,9 +51,11 @@ fn (mut f Flag) free() {
|
||||
|
||||
// str returns a string representation of the given Flag
|
||||
pub fn (f Flag) str() string {
|
||||
return '' + ' flag:\n' + ' name: ${f.name}\n' +
|
||||
' abbr: `${f.abbr.ascii_str()}`\n' + ' usage: ${f.usage}\n' +
|
||||
' desc: ${f.val_desc}'
|
||||
return ' flag:
|
||||
name: ${f.name}
|
||||
abbr: `${f.abbr.ascii_str()}`
|
||||
usage: ${f.usage}
|
||||
desc: ${f.val_desc}'
|
||||
}
|
||||
|
||||
// str returns a string representation of the given array of Flags
|
||||
|
@ -56,10 +56,10 @@ fn new_ft(c FTConfig) ?&FT {
|
||||
fons.set_error_callback(clear_atlas_callback, fons)
|
||||
return &FT{
|
||||
fons: fons
|
||||
font_normal: fons.add_font_mem('sans', bytes_normal, false)
|
||||
font_bold: fons.add_font_mem('sans', bytes_bold, false)
|
||||
font_mono: fons.add_font_mem('sans', bytes_mono, false)
|
||||
font_italic: fons.add_font_mem('sans', bytes_italic, false)
|
||||
font_normal: fons.add_font_mem('sans', bytes_normal.clone(), false)
|
||||
font_bold: fons.add_font_mem('sans', bytes_bold.clone(), false)
|
||||
font_mono: fons.add_font_mem('sans', bytes_mono.clone(), false)
|
||||
font_italic: fons.add_font_mem('sans', bytes_italic.clone(), false)
|
||||
scale: c.scale
|
||||
}
|
||||
} else {
|
||||
@ -122,10 +122,10 @@ fn new_ft(c FTConfig) ?&FT {
|
||||
fons.set_error_callback(clear_atlas_callback, fons)
|
||||
return &FT{
|
||||
fons: fons
|
||||
font_normal: fons.add_font_mem('sans', bytes, false)
|
||||
font_bold: fons.add_font_mem('sans', bytes_bold, false)
|
||||
font_mono: fons.add_font_mem('sans', bytes_mono, false)
|
||||
font_italic: fons.add_font_mem('sans', bytes_italic, false)
|
||||
font_normal: fons.add_font_mem('sans', bytes.clone(), false)
|
||||
font_bold: fons.add_font_mem('sans', bytes_bold.clone(), false)
|
||||
font_mono: fons.add_font_mem('sans', bytes_mono.clone(), false)
|
||||
font_italic: fons.add_font_mem('sans', bytes_italic.clone(), false)
|
||||
scale: c.scale
|
||||
}
|
||||
}
|
||||
|
@ -135,5 +135,5 @@ pub fn get_path_variant(font_path string, variant Variant) string {
|
||||
}
|
||||
}
|
||||
}
|
||||
return fpath + file + '.ttf'
|
||||
return '${fpath}${file}.ttf'
|
||||
}
|
||||
|
13
vlib/os/os.v
13
vlib/os/os.v
@ -554,11 +554,16 @@ pub fn home_dir() string {
|
||||
// See also `home_dir()`.
|
||||
pub fn expand_tilde_to_home(path string) string {
|
||||
if path == '~' {
|
||||
return home_dir().trim_right(path_separator)
|
||||
hdir := home_dir()
|
||||
return hdir.trim_right(path_separator)
|
||||
}
|
||||
if path.starts_with('~' + path_separator) {
|
||||
return path.replace_once('~' + path_separator, home_dir().trim_right(path_separator) +
|
||||
path_separator)
|
||||
source := '~' + path_separator
|
||||
if path.starts_with(source) {
|
||||
hdir := home_dir()
|
||||
trimmed := hdir.trim_right(path_separator)
|
||||
final := trimmed + path_separator
|
||||
result := path.replace_once(source, final)
|
||||
return result
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user