summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-05-13 21:33:32 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-05-13 21:33:32 (GMT)
commit79279ff1ca39daa66f69addece5c01fbfaae1d01 (patch)
tree9a293d23d8a26d6e1a153b4d083bc0ee9206545a
parent09b826d5ceae5932452b95e44dab0e169fdc0ddd (diff)
downloadtk-79279ff1ca39daa66f69addece5c01fbfaae1d01.zip
tk-79279ff1ca39daa66f69addece5c01fbfaae1d01.tar.gz
tk-79279ff1ca39daa66f69addece5c01fbfaae1d01.tar.bz2
[Bug 2791352] handle parsing of type 5 font descriptions with hyphenated family name.
-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 ab378c0..70d16ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkFont.c: [Bug 2791352] handle parsing of type 5 font
+ * tests/font.test: descriptions with hyphenated family name.
+
2009-05-06 Pat Thoyts <patthoyts@users.sourceforge.net>
* library/images/lamp.svg: Added an SVG version of the Tk lamp and
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 21ff311..70240c6 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.53 2009/02/03 23:55:47 nijtmans Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.54 2009/05/13 21:33:32 patthoyts Exp $
*/
#include "tkInt.h"
@@ -3608,6 +3608,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 6cf820e..2d7a7f9 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.19 2008/08/15 01:10:03 aniap Exp $
+# RCS: @(#) $Id: font.test,v 1.20 2009/05/13 21:33:32 patthoyts Exp $
package require tcltest 2.2
namespace import ::tcltest::*
@@ -2221,6 +2221,12 @@ test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints {
test font-38.12 {ParseFontNameObj procedure: stylelist error} -body {
font actual {times 12 bold xyz}
} -returnCodes error -result {unknown font style "xyz"}
+test font-38.13 "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.14 "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} -setup {