diff options
author | jenglish <jenglish@flightlab.com> | 2008-01-27 16:44:11 (GMT) |
---|---|---|
committer | jenglish <jenglish@flightlab.com> | 2008-01-27 16:44:11 (GMT) |
commit | 2ee3bde1cf15a39a891bf130c118f93222cd6583 (patch) | |
tree | 003bc250ac213171340d3db37f20f222c49e6d8f /unix | |
parent | e695ccdf159a6c9f54b216986d300e3f67b6d69e (diff) | |
download | tk-2ee3bde1cf15a39a891bf130c118f93222cd6583.zip tk-2ee3bde1cf15a39a891bf130c118f93222cd6583.tar.gz tk-2ee3bde1cf15a39a891bf130c118f93222cd6583.tar.bz2 |
Fix [Bug 835848].
Use FcTypeDouble for XFT_SIZE attribute.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixRFont.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index f14ba40..b6739ba 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixRFont.c,v 1.21 2008/01/27 16:40:24 jenglish Exp $ + * RCS: @(#) $Id: tkUnixRFont.c,v 1.22 2008/01/27 16:44:12 jenglish Exp $ */ #include "tkUnixInt.h" @@ -101,16 +101,21 @@ GetTkFontAttributes( TkFontAttributes *faPtr) { char *family; - int weight, slant; - double size; + int weight, slant, size, pxsize; + double ptsize; if (XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, &family) != XftResultMatch) { family = "Unknown"; } if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, - &size) != XftResultMatch) { - size = 12.0; + &ptsize) == XftResultMatch) { + size = (int)ptsize; + } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, + &pxsize) == XftResultMatch) { + size = -pxsize; + } else { + size = 12; } if (XftPatternGetInteger(ftFont->pattern, XFT_WEIGHT, 0, &weight) != XftResultMatch) { @@ -122,12 +127,12 @@ GetTkFontAttributes( } #if DEBUG_FONTSEL - printf("family %s size %g weight %d slant %d\n", + printf("family %s size %d weight %d slant %d\n", family, size, weight, slant); #endif /* DEBUG_FONTSEL */ faPtr->family = Tk_GetUid(family); - faPtr->size = (int) size; + faPtr->size = size; faPtr->weight = (weight > XFT_WEIGHT_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL; faPtr->slant = (slant > XFT_SLANT_ROMAN) ? TK_FS_ITALIC : TK_FS_ROMAN; faPtr->underline = 0; @@ -330,11 +335,11 @@ TkpGetFontFromAttributes( XftPatternAddString(pattern, XFT_FAMILY, faPtr->family); } if (faPtr->size > 0) { - XftPatternAddInteger(pattern, XFT_SIZE, faPtr->size); + XftPatternAddDouble(pattern, XFT_SIZE, (double)faPtr->size); } else if (faPtr->size < 0) { XftPatternAddInteger(pattern, XFT_PIXEL_SIZE, -faPtr->size); } else { - XftPatternAddInteger(pattern, XFT_SIZE, 12); + XftPatternAddDouble(pattern, XFT_SIZE, 12.0); } switch (faPtr->weight) { case TK_FW_NORMAL: |