gg: prevent messages about missing font variants without `-d debug_font`
parent
d782de5b00
commit
af37c7ac6b
|
@ -56,17 +56,17 @@ fn new_ft(c FTConfig) ?&FT{
|
||||||
}
|
}
|
||||||
bold_path := get_font_path_variant(c.font_path, .bold)
|
bold_path := get_font_path_variant(c.font_path, .bold)
|
||||||
bytes_bold := os.read_bytes(bold_path) or {
|
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
|
bytes
|
||||||
}
|
}
|
||||||
mono_path := get_font_path_variant(c.font_path, .mono)
|
mono_path := get_font_path_variant(c.font_path, .mono)
|
||||||
bytes_mono:= os.read_bytes(mono_path) or {
|
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
|
bytes
|
||||||
}
|
}
|
||||||
italic_path := get_font_path_variant(c.font_path, .italic)
|
italic_path := get_font_path_variant(c.font_path, .italic)
|
||||||
bytes_italic:= os.read_bytes(italic_path) or {
|
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
|
bytes
|
||||||
}
|
}
|
||||||
fons := sfons.create(512, 512, 1)
|
fons := sfons.create(512, 512, 1)
|
||||||
|
@ -80,7 +80,6 @@ fn new_ft(c FTConfig) ?&FT{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (ctx &Context) set_cfg(cfg gx.TextCfg) {
|
fn (ctx &Context) set_cfg(cfg gx.TextCfg) {
|
||||||
if !ctx.font_inited {
|
if !ctx.font_inited {
|
||||||
return
|
return
|
||||||
|
@ -246,3 +245,9 @@ fn get_font_path_variant(font_path string, variant FontVariant) string {
|
||||||
}
|
}
|
||||||
return fpath + '.ttf'
|
return fpath + '.ttf'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn debug_font_println(s string) {
|
||||||
|
$if debug_font? {
|
||||||
|
println(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue