gg: custom bold font path
parent
d3deaa1f59
commit
0ddf0a4b92
vlib
v/fmt
|
@ -57,7 +57,8 @@ pub:
|
|||
// vid needs this
|
||||
// init_text bool
|
||||
font_path string
|
||||
ui_mode bool
|
||||
custom_bold_font_path string
|
||||
ui_mode bool // refreshes only on events to save CPU usage
|
||||
}
|
||||
|
||||
pub struct Context {
|
||||
|
@ -122,6 +123,7 @@ fn gg_init_sokol_window(user_data voidptr) {
|
|||
// t := time.ticks()
|
||||
g.ft = new_ft({
|
||||
font_path: g.config.font_path
|
||||
custom_bold_font_path: g.config.custom_bold_font_path
|
||||
scale: sapp.dpi_scale()
|
||||
}) or {
|
||||
panic(err)
|
||||
|
|
|
@ -26,6 +26,7 @@ pub:
|
|||
|
||||
struct FTConfig {
|
||||
font_path string
|
||||
custom_bold_font_path string
|
||||
scale f32 = 1.0
|
||||
font_size int
|
||||
}
|
||||
|
@ -52,7 +53,7 @@ fn new_ft(c FTConfig) ?&FT {
|
|||
return none
|
||||
}
|
||||
}
|
||||
bold_path := get_font_path_variant(c.font_path, .bold)
|
||||
bold_path := if c.custom_bold_font_path != '' { c.custom_bold_font_path } else { get_font_path_variant(c.font_path, .bold)}
|
||||
bytes_bold := os.read_bytes(bold_path) or {
|
||||
debug_font_println('failed to load font "$bold_path"')
|
||||
bytes
|
||||
|
|
|
@ -1265,7 +1265,7 @@ pub fn (mut f Fmt) fn_decl(node ast.FnDecl) {
|
|||
f.stmts(node.stmts)
|
||||
f.write('}')
|
||||
}
|
||||
if !node.is_anon {
|
||||
if !node.is_anon && !node.no_body {
|
||||
f.writeln('\n')
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue