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

gg: mute font print on Linux, use flag debug_font instead (#12082)

This commit is contained in:
Larpon 2021-10-07 02:45:02 +02:00 committed by GitHub
parent 32259af2c9
commit 42c088896a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,7 @@ pub fn system_font_path() string {
return env_font
}
$if windows {
debug_font_println('Using font "C:\\Windows\\Fonts\\arial.ttf"')
return 'C:\\Windows\\Fonts\\arial.ttf'
}
mut fonts := ['Ubuntu-R.ttf', 'Arial.ttf', 'LiberationSans-Regular.ttf', 'NotoSans-Regular.ttf',
@ -45,6 +46,7 @@ pub fn system_font_path() string {
'/Library/Fonts/Arial.ttf']
for font in fonts {
if os.is_file(font) {
debug_font_println('Using font "$font"')
return font
}
}
@ -66,6 +68,7 @@ pub fn system_font_path() string {
for location in font_locations {
candidate_path := os.join_path(location, candidate_font)
if os.is_file(candidate_path) && os.is_readable(candidate_path) {
debug_font_println('Using font "$candidate_path"')
return candidate_path
}
}
@ -84,7 +87,7 @@ pub fn system_font_path() string {
for font in fonts {
if line.contains(font) && line.contains(':') {
res := line.all_before(':')
println('Using font $res')
debug_font_println('Using font "$res"')
return res
}
}
@ -141,8 +144,7 @@ fn get_font_path_variant(font_path string, variant FontVariant) string {
return fpath + file + '.ttf'
}
[if debug_font ?]
fn debug_font_println(s string) {
$if debug_font ? {
println(s)
}
println(s)
}