fix scaling of X fonts when text effects (such as italic) are implemented as transformations

svn: r16501
This commit is contained in:
Matthew Flatt 2009-11-02 13:41:02 +00:00
parent ccd6659100
commit 16e3ee3e6c

View File

@ -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);