diff options
author | Thomas White <taw@physics.org> | 2017-10-23 22:03:17 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-10-23 22:03:17 +0200 |
commit | 1a1a23332c81284745c478b60d64b654da27f196 (patch) | |
tree | 151a4cd83bb6476527e09849e7e13dd715c89af0 | |
parent | 0415e3697398e74e4e5a3620190c103ad402b129 (diff) |
Handle NULL PangoContext
Used when getting the templates
-rw-r--r-- | src/sc_interp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c index 255fe91..56fae6a 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -594,13 +594,16 @@ SCInterpreter *sc_interp_new(PangoContext *pc, PangoLanguage *lang, st->paraspace[1] = 0.0; st->paraspace[2] = 0.0; st->paraspace[3] = 0.0; + st->fontdesc = NULL; scin->lang = lang; /* The "ultimate" default font */ - set_font(scin, "Sans 12"); - set_colour(scin, "#000000"); - set_frame(scin, top); + if ( scin->pc != NULL ) { + set_font(scin, "Cantarell Regular 14"); + set_colour(scin, "#000000"); + set_frame(scin, top); + } return scin; } @@ -615,7 +618,9 @@ void sc_interp_destroy(SCInterpreter *scin) sc_interp_restore(scin); } - pango_font_description_free(scin->state[0].fontdesc); + if ( scin->state[0].fontdesc != NULL ) { + pango_font_description_free(scin->state[0].fontdesc); + } free(scin->state); free(scin); |