From 94b55c68d687d01989da7e46718b4a2c51c0df2a Mon Sep 17 00:00:00 2001 From: vdhoeven Date: Wed, 25 Aug 2010 17:01:17 +0000 Subject: [PATCH] Cleaner font handling under X git-svn-id: svn://svn.savannah.gnu.org/texmacs/trunk@3059 64cb5145-927a-446d-8aed-2fb7b4773692 --- src/src/Plugins/X11/x_font.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/src/Plugins/X11/x_font.cpp b/src/src/Plugins/X11/x_font.cpp index 24d0901b..c944e736 100644 --- a/src/src/Plugins/X11/x_font.cpp +++ b/src/src/Plugins/X11/x_font.cpp @@ -262,15 +262,15 @@ x_gui_rep::load_system_font (string family, int size, int dpi, if (DEBUG_VERBOSE) cout << "TeXmacs] Loading ps font " << name << "\n"; char* temp= as_charp (name); - Font fn = XLoadFont (dpy, temp); + XFontStruct *xfs = XLoadQueryFont (dpy, temp); tm_delete_array (temp); - if (XQueryFont (dpy, fn) == NULL) { + if (xfs == NULL) { if (DEBUG_VERBOSE) cout << "TeXmacs] Font " << name << " not found\n"; if (DEBUG_VERBOSE) cout << "TeXmacs] Using default font instead\n"; - fn = XLoadFont (dpy, "*"); - ASSERT (XQueryFont (dpy, fn) != NULL, "could not load default X font"); + xfs = XLoadQueryFont (dpy, "*"); + ASSERT (xfs != NULL, "could not load default X font"); } - + Font fn = xfs->fid; int i; metric* texs= tm_new_array (256); glyph * gls = tm_new_array (256); @@ -278,6 +278,8 @@ x_gui_rep::load_system_font (string family, int size, int dpi, get_ps_char (fn, i, texs[i], gls[i]); fnm= std_font_metric (fn_name, texs, 0, 255); fng= std_font_glyphs (fn_name, gls , 0, 255); + + XFreeFont(dpy, xfs); } void -- 2.11.4.GIT