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

gg: prevent messages about missing font variants without -d debug_font

This commit is contained in:
Delyan Angelov 2020-09-26 09:36:46 +03:00
parent d782de5b00
commit af37c7ac6b

View File

@ -56,17 +56,17 @@ fn new_ft(c FTConfig) ?&FT{
}
bold_path := get_font_path_variant(c.font_path, .bold)
bytes_bold := os.read_bytes(bold_path) or {
println('failed to load font "$bold_path"')
debug_font_println('failed to load font "$bold_path"')
bytes
}
mono_path := get_font_path_variant(c.font_path, .mono)
bytes_mono:= os.read_bytes(mono_path) or {
println('failed to load font "$mono_path"')
debug_font_println('failed to load font "$mono_path"')
bytes
}
italic_path := get_font_path_variant(c.font_path, .italic)
bytes_italic:= os.read_bytes(italic_path) or {
println('failed to load font "$italic_path"')
debug_font_println('failed to load font "$italic_path"')
bytes
}
fons := sfons.create(512, 512, 1)
@ -80,7 +80,6 @@ fn new_ft(c FTConfig) ?&FT{
}
}
fn (ctx &Context) set_cfg(cfg gx.TextCfg) {
if !ctx.font_inited {
return
@ -246,3 +245,9 @@ fn get_font_path_variant(font_path string, variant FontVariant) string {
}
return fpath + '.ttf'
}
fn debug_font_println(s string) {
$if debug_font? {
println(s)
}
}