From 16e3ee3e6c0c01aac6e253d9e62ae6855b4a1430 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 2 Nov 2009 13:41:02 +0000 Subject: [PATCH] fix scaling of X fonts when text effects (such as italic) are implemented as transformations svn: r16501 --- src/wxxt/src/GDI-Classes/Font.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/wxxt/src/GDI-Classes/Font.cc b/src/wxxt/src/GDI-Classes/Font.cc index 7662a363ae..366c717e2d 100644 --- a/src/wxxt/src/GDI-Classes/Font.cc +++ b/src/wxxt/src/GDI-Classes/Font.cc @@ -802,16 +802,24 @@ static wxFontStruct *wxLoadQueryNearestAAFont(const char *name, pat = XftFontMatch(wxAPP_DISPLAY, DefaultScreen(wxAPP_DISPLAY), pat, &res); if (!pat) return NULL; - + if (use_rot) { /* We add a transform after match, because Xft/fontconfig seems to sometimes free a non-malloced pointer if we include the transformation in the pattern to match. The transformation presumably doesn't affect matching, anyway, so adding it now should be fine. */ - pat = XftPatternBuild(pat, - XFT_MATRIX, XftTypeMatrix, &rot, - NULL); + XftMatrix *old_m; + + if (!XftPatternGetMatrix(pat, XFT_MATRIX, 0, &old_m)) { + /* Has existing matrix, so add rotation and scale: */ + XftMatrixRotate(old_m, cos(angle), sin(angle)); + XftMatrixScale(old_m, scale_x, scale_y); + } else { + pat = XftPatternBuild(pat, + XFT_MATRIX, XftTypeMatrix, &rot, + NULL); + } } fs = XftFontOpenPattern(wxAPP_DISPLAY, pat);