diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-13 14:20:48 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-13 14:20:48 (GMT) |
commit | 197af66838a4afe02bcdaf42586f15b9ddf51506 (patch) | |
tree | 123adb5a4c5efd7f40b2fe545f46c97f494dc9ff /unix | |
parent | b9a4361754a553ade5449d8410f5ac5b021f7e00 (diff) | |
parent | cd1b5a01e9f3f9e374db30c2af5943ae34e2cf32 (diff) | |
download | tk-197af66838a4afe02bcdaf42586f15b9ddf51506.zip tk-197af66838a4afe02bcdaf42586f15b9ddf51506.tar.gz tk-197af66838a4afe02bcdaf42586f15b9ddf51506.tar.bz2 |
Merge 8.6.
One more use of Tk_CreateErrorHandler(), suggested by Christian Werner. Now it works on Ubuntu too!
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixRFont.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index cf8c68f..2c3d91f 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -711,12 +711,15 @@ Tk_MeasureChars( FcChar32 c; XGlyphInfo extents; int clen, curX, newX, curByte, newByte, sawNonSpace; - int termByte = 0, termX = 0; + int termByte = 0, termX = 0, errorFlag = 0; + Tk_ErrorHandler handler; #if DEBUG_FONTSEL char string[256]; int len = 0; #endif /* DEBUG_FONTSEL */ + handler = Tk_CreateErrorHandler(fontPtr->display, + -1, -1, -1, InitFontErrorProc, &errorFlag); curX = 0; curByte = 0; sawNonSpace = 0; @@ -752,7 +755,12 @@ Tk_MeasureChars( #endif /* DEBUG_FONTSEL */ ftFont = GetFont(fontPtr, c, 0.0); - XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents); + if (!errorFlag) { + XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents); + } else { + extents.xOff = 0; + errorFlag = 0; + } newX = curX + extents.xOff; newByte = curByte + clen; @@ -781,6 +789,7 @@ Tk_MeasureChars( curX = newX; curByte = newByte; } + Tk_DeleteErrorHandler(handler); #if DEBUG_FONTSEL string[len] = '\0'; printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte); |