From 1892d2431705061c0c3046cdd7c7d4ef05fc3255 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 3 Aug 2016 17:56:38 -0700 Subject: [PATCH] get all layouts from the same place --- xwords4/linux/gtkdraw.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/xwords4/linux/gtkdraw.c b/xwords4/linux/gtkdraw.c index a3ac4f54a..f22de74f8 100644 --- a/xwords4/linux/gtkdraw.c +++ b/xwords4/linux/gtkdraw.c @@ -292,12 +292,7 @@ draw_string_at( GtkDrawCtx* dctx, PangoLayout* layout, if ( !!layout ) { g_object_ref( layout ); } else { - layout = pango_cairo_create_layout( cr ); - gchar buf[32]; - sprintf( buf, "Sans Bold %d", (fontHt * 2) / 3 ); - PangoFontDescription* desc = pango_font_description_from_string( buf ); - pango_layout_set_font_description( layout, desc ); - pango_font_description_free( desc ); + layout = layout_for_ht( dctx, fontHt ); } pango_layout_set_text( layout, (char*)str, XP_STRLEN(str) ); @@ -1382,13 +1377,11 @@ allocAndSet( GDKCOLORMAP* map, GdkRGBA* color, unsigned short red, DrawCtx* gtkDrawCtxtMake( GtkWidget* drawing_area, GtkGameGlobals* globals ) { - GtkDrawCtx* dctx = g_malloc0( sizeof(GtkDrawCtx) ); - - short ii; + GtkDrawCtx* dctx = g_malloc0( sizeof(*dctx) ); dctx->vtable = g_malloc( sizeof(*(((GtkDrawCtx*)dctx)->vtable)) ); - for ( ii = 0; ii < VSIZE(dctx->vtable); ++ii ) { + for ( int ii = 0; ii < VSIZE(dctx->vtable); ++ii ) { ((void**)(dctx->vtable))[ii] = draw_doNothing; /* bad? */ }