From db2346069a53a57a126620478b186aff50a63b94 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 13 Jul 2020 01:02:47 +0200 Subject: [PATCH] gg: always use stb_truetype for now --- thirdparty/fontstash/fontstash.h | 1 + vlib/gg/gg.v | 3 +++ vlib/gg/text_rendering.v | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/thirdparty/fontstash/fontstash.h b/thirdparty/fontstash/fontstash.h index fc0b707924..45f1560a75 100644 --- a/thirdparty/fontstash/fontstash.h +++ b/thirdparty/fontstash/fontstash.h @@ -172,6 +172,7 @@ FONS_DEF void fonsDrawDebug(FONScontext* s, float x, float y); #endif #endif +#undef FONS_USE_FREETYPE #ifdef FONS_USE_FREETYPE diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index 3a47b14d64..58fc8ebd15 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -215,6 +215,9 @@ pub fn (ctx &Context) draw_empty_rect(x, y, w, h f32, c gx.Color) { sgl.end() } +pub fn (ctx &Context) draw_circle(x, y, r f32, c gx.Color) { +} + pub fn create_image(file string) u32 { // println('gg create image "$file"') if !os.exists(file) { diff --git a/vlib/gg/text_rendering.v b/vlib/gg/text_rendering.v index d7b388cf88..f9f3165815 100644 --- a/vlib/gg/text_rendering.v +++ b/vlib/gg/text_rendering.v @@ -51,7 +51,8 @@ pub fn (ctx &Context) draw_text(x, y int, text string, cfg gx.TextCfg) { } ctx.ft.fons.set_font(ctx.ft.font_normal) scale := if ctx.ft.scale == 0 { f32(1) } else { ctx.ft.scale } - ctx.ft.fons.set_size(scale * f32(cfg.size)) + size := if cfg.size == 0 { gg.default_font_size } else { cfg.size } + ctx.ft.fons.set_size(scale * f32(size)) if cfg.align == gx.align_right { C.fonsSetAlign(ctx.ft.fons, C.FONS_ALIGN_RIGHT | C.FONS_ALIGN_TOP) }