diff options
author | jenglish@flightlab.com <jenglish> | 2008-01-27 16:44:11 (GMT) |
---|---|---|
committer | jenglish@flightlab.com <jenglish> | 2008-01-27 16:44:11 (GMT) |
commit | c71850a15d7edeaee4feee71eff59ccb7aa8b738 (patch) | |
tree | 003bc250ac213171340d3db37f20f222c49e6d8f /unix/tkUnixRFont.c | |
parent | 7fda09b3efc85ec96e5f4fbfb27fe7e18b779a94 (diff) | |
download | tk-c71850a15d7edeaee4feee71eff59ccb7aa8b738.zip tk-c71850a15d7edeaee4feee71eff59ccb7aa8b738.tar.gz tk-c71850a15d7edeaee4feee71eff59ccb7aa8b738.tar.bz2 |
Fix [Bug 835848].
Use FcTypeDouble for XFT_SIZE attribute.
Diffstat (limited to 'unix/tkUnixRFont.c')
-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: |