adjust imgui font system
[vg.git] / vg_imgui.h
index f2d4f05cdaecf84679823c21784bed8667c5dc43..955f365975794c31b0d773e7bed1ff4205c40593 100644 (file)
 #include "vg_engine.h"
 #include "vg_tex.h"
 #include "vg_shader.h"
+#include "vg_font.h"
+
+extern vg_font_sheet vg_default_font_sheet;
+extern vg_font_face vgf_default_small, vgf_default_large, vgf_default_title;
 
 typedef i16                            ui_px;
 typedef ui_px                          ui_rect[4];
@@ -83,21 +87,6 @@ extern ui_px k_ui_widget_height,
 
 typedef u32 ui_scheme[8*4];
 
-struct ui_font {
-   ui_px glyph_width,
-         glyph_height,
-         glyph_baseline,
-         line_height,
-         sheet_size,
-         spacing,
-         offset_y;
-
-   u8 ascii_start;
-};
-typedef struct ui_font ui_font;
-
-extern ui_font vg_ui_font_small, vg_ui_font_big;
-
 #define UI_RGB( STDHEX )          0xff000000       |\
                          ((STDHEX&0x000000ff)<<16) |\
                          ((STDHEX&0x0000ff00)    ) |\
@@ -200,7 +189,8 @@ struct vg_imgui
    f32 frosting;
 
    ui_scheme scheme;
-   const ui_font *font;
+   const vg_font_face *font;
+   v2f inverse_font_sheet;
 
    enum ui_cursor{
       k_ui_cursor_default,
@@ -260,6 +250,7 @@ void ui_hex_to_norm( u32 hex, v4f norm );
 u32 v4f_u32_colour( v4f colour );
 
 u32 ui_opacity( u32 colour, f32 opacity );
+void ui_font_face( vg_font_face *ff );
 u32 ui_ntext( ui_rect rect, const char *str, u32 len, ui_px scale, 
               enum ui_align align, u32 colour );
 void ui_text( ui_rect rect, const char *str, ui_px scale,