summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-05-13 21:49:12 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-05-13 21:49:12 (GMT)
commita49b9d01cc58374d6882839ff6e9ca8c14c88c0a (patch)
tree0ef1a4720feb68bce3dd4e49bf87f4f1d5a1829f
parent17870f6d9fd45524f08ad067e0ad7a57a9fed719 (diff)
downloadtk-a49b9d01cc58374d6882839ff6e9ca8c14c88c0a.zip
tk-a49b9d01cc58374d6882839ff6e9ca8c14c88c0a.tar.gz
tk-a49b9d01cc58374d6882839ff6e9ca8c14c88c0a.tar.bz2
[Bug 2791352] backported fix and tests for mis-parsing of certain font descriptions.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkFont.c16
-rw-r--r--tests/font.test8
3 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 55507c9..f7b29f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkFont.c: [Bug 2791352]: backported fix and tests for
+ * tests/font.test: mis-parsing of certain font descriptions.
+
2009-05-03 Donal K. Fellows <dkf@users.sf.net>
* win/tkWinWm.c (UpdateWrapper): [Bug 2785744]: Manipulate flag bit
diff --git a/generic/tkFont.c b/generic/tkFont.c
index e48a0d5..3839ef0 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFont.c,v 1.42.2.1 2009/03/03 23:54:11 patthoyts Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.42.2.2 2009/05/13 21:49:12 patthoyts Exp $
*/
#include "tkInt.h"
@@ -3235,6 +3235,20 @@ ParseFontNameObj(
if (result == TCL_OK) {
return TCL_OK;
}
+
+ /*
+ * If the string failed to parse but was considered to be a XLFD
+ * then it may be a "-option value" string with a hyphenated family
+ * name as per bug 2791352
+ */
+
+ if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (ConfigAttributesObj(interp, tkwin, objc, objv, faPtr) == TCL_OK) {
+ return TCL_OK;
+ }
}
/*
diff --git a/tests/font.test b/tests/font.test
index cb06512..3c72f75 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: font.test,v 1.17 2007/12/13 15:27:54 dgp Exp $
+# RCS: @(#) $Id: font.test,v 1.17.2.1 2009/05/13 21:49:12 patthoyts Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -1267,6 +1267,12 @@ test font-38.12 {ParseFontNameObj procedure: stylelist loop} {unixOrPc} {
test font-38.13 {ParseFontNameObj procedure: stylelist error} {
list [catch {font actual {times 12 bold xyz}} msg] $msg
} {1 {unknown font style "xyz"}}
+test font-38.14 "ParseFontNameObj: options with hyphenated family: bug #2791352" -body {
+ font actual {-family sans-serif -size 12 -weight bold -slant roman -underline 0 -overstrike 0}
+} -returnCodes ok -result [font actual {sans-serif 12 bold}]
+test font-38.15 "ParseFontNameObj: bug #2791352" -body {
+ font actual {-invalidfont 8 bold}
+} -returnCodes error -match glob -result {bad option "-invalidfont": *}
test font-39.1 {NewChunk procedure: test realloc} {
.b.f config -text "xxx\nxxx\txxx\nxxx\t\t\t"