diff options
author | dgp <dgp@users.sourceforge.net> | 2008-01-29 17:35:46 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-01-29 17:35:46 (GMT) |
commit | 9ccc1a8aa914ebe1de82ca8644458ddb0b411d45 (patch) | |
tree | 64759761e5b84adf8c5300742390224c87afa0a1 /unix | |
parent | eabe2bf04950081714881265b538ee8d12cfe6be (diff) | |
download | tk-9ccc1a8aa914ebe1de82ca8644458ddb0b411d45.zip tk-9ccc1a8aa914ebe1de82ca8644458ddb0b411d45.tar.gz tk-9ccc1a8aa914ebe1de82ca8644458ddb0b411d45.tar.bz2 |
merge updates from HEAD
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixRFont.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index e262f22..99d2c57 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.20.2.1 2008/01/28 14:22:29 dgp Exp $ + * RCS: @(#) $Id: tkUnixRFont.c,v 1.20.2.2 2008/01/29 17:35:51 dgp Exp $ */ #include "tkUnixInt.h" @@ -100,14 +100,11 @@ GetTkFontAttributes( XftFont *ftFont, TkFontAttributes *faPtr) { - char *family; + char *family = "Unknown", **familyPtr = &family; int weight, slant, size, pxsize; double ptsize; - if (XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, - &family) != XftResultMatch) { - family = "Unknown"; - } + (void)XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { size = (int)ptsize; @@ -406,10 +403,9 @@ TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ Tk_Window tkwin) /* For display to query. */ { - Tcl_Obj *resultPtr, *strPtr; + Tcl_Obj *resultPtr; XftFontSet *list; int i; - char *family; resultPtr = Tcl_NewListObj(0, NULL); @@ -417,9 +413,11 @@ TkpGetFontFamilies( (char*)0, /* pattern elements */ XFT_FAMILY, (char*)0); /* fields */ for (i = 0; i < list->nfont; i++) { - if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, - &family) == XftResultMatch) { - strPtr = Tcl_NewStringObj(Tk_GetUid(family), -1); + char *family, **familyPtr = &family; + if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, familyPtr) + == XftResultMatch) + { + Tcl_Obj *strPtr = Tcl_NewStringObj(family, -1); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } } @@ -449,7 +447,9 @@ TkpGetSubFonts( Tcl_Obj *objv[3], *listPtr, *resultPtr; UnixFtFont *fontPtr = (UnixFtFont *) tkfont; FcPattern *pattern; - char *family, *foundry, *encoding; + char *family = "Unknown", **familyPtr = &family; + char *foundry = "Unknown", **foundryPtr = &foundry; + char *encoding = "Unknown", **encodingPtr = &encoding; int i; resultPtr = Tcl_NewListObj(0, NULL); @@ -458,18 +458,9 @@ TkpGetSubFonts( pattern = FcFontRenderPrepare(0, fontPtr->pattern, fontPtr->faces[i].source); - if (XftPatternGetString(pattern, XFT_FAMILY, 0, - &family) != XftResultMatch) { - family = "Unknown"; - } - if (XftPatternGetString(pattern, XFT_FOUNDRY, 0, - &foundry) != XftResultMatch) { - foundry = "Unknown"; - } - if (XftPatternGetString(pattern, XFT_ENCODING, 0, - &encoding) != XftResultMatch) { - encoding = "Unknown"; - } + XftPatternGetString(pattern, XFT_FAMILY, 0, familyPtr); + XftPatternGetString(pattern, XFT_FOUNDRY, 0, foundryPtr); + XftPatternGetString(pattern, XFT_ENCODING, 0, encodingPtr); objv[0] = Tcl_NewStringObj(family, -1); objv[1] = Tcl_NewStringObj(foundry, -1); objv[2] = Tcl_NewStringObj(encoding, -1); |