[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xterm: Changes to 'debian-unstable'



 MANIFEST                 |    2 
 cachedGCs.c              |   44 ++++++------
 charproc.c               |   82 ++++++++++++++++++++++-
 debian/changelog         |   10 ++
 fontutils.c              |  144 ++++++++++++++++++++++++++++++++--------
 fontutils.h              |   11 +--
 package/debian/changelog |    6 +
 package/freebsd/Makefile |    2 
 package/xterm.spec       |    4 -
 print.c                  |    8 +-
 ptyx.h                   |    5 +
 screen.c                 |    9 +-
 util.c                   |  166 +++++++++++++++++++++++++++++++++--------------
 version.h                |    6 -
 xterm.appdata.xml        |    3 
 xterm.h                  |    3 
 xterm.log.html           |   36 +++++++++-
 17 files changed, 419 insertions(+), 122 deletions(-)

New commits:
commit 4a18775fa451e53291aabfa7b9abfbf163baf918
Author: Sven Joachim <svenjoac@gmx.de>
Date:   Wed Jun 18 17:44:48 2014 +0200

    Close bugs fixed in the new upstream release

diff --git a/debian/changelog b/debian/changelog
index 9c5c11f..36489b2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,10 @@
 xterm (307-1) UNRELEASED; urgency=medium
 
   * New upstream release.
+    - Amend fix for Freedesktop bug #15979 (Closes: #750733).
+    - Amend resets for keyboard-type, pointer-mode and title-modes
+      from xterm 305 changes to account for resource settings
+      (Closes: #751351).
 
  -- Sven Joachim <svenjoac@gmx.de>  Wed, 18 Jun 2014 17:39:07 +0200
 

commit a12891ac8eeff45d86d882c948993f807c1e1cd3
Author: Sven Joachim <svenjoac@gmx.de>
Date:   Wed Jun 18 17:39:18 2014 +0200

    New upstream release

diff --git a/debian/changelog b/debian/changelog
index 095a545..9c5c11f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xterm (307-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Sven Joachim <svenjoac@gmx.de>  Wed, 18 Jun 2014 17:39:07 +0200
+
 xterm (306-1) unstable; urgency=medium
 
   [ Julien Cristau ]

commit 0d7b6a924fe5a9a62bba90df7a821e12a6dde98c
Author: Sven Joachim <svenjoac@gmx.de>
Date:   Wed Jun 18 17:36:57 2014 +0200

    Imported Upstream version 307

diff --git a/MANIFEST b/MANIFEST
index fc36f79..a54262d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-306, version xterm-306
+MANIFEST for xterm-307, version xterm-307
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
diff --git a/cachedGCs.c b/cachedGCs.c
index 21d3bb7..3dd1cd9 100644
--- a/cachedGCs.c
+++ b/cachedGCs.c
@@ -1,7 +1,7 @@
-/* $XTermId: cachedGCs.c,v 1.61 2011/09/11 14:59:38 tom Exp $ */
+/* $XTermId: cachedGCs.c,v 1.62 2014/06/12 23:04:07 tom Exp $ */
 
 /*
- * Copyright 2007-2010,2011 by Thomas E. Dickey
+ * Copyright 2007-2011,2014 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -120,7 +120,7 @@ traceCgsEnum(CgsEnum value)
 #undef CASE
 
 static const char *
-traceVTwin(XtermWidget xw, VTwin * value)
+traceVTwin(XtermWidget xw, VTwin *value)
 {
     const char *result = "?";
     if (value == 0)
@@ -273,7 +273,7 @@ relinkData(CgsCache * me, int item)
  * Returns the appropriate cache pointer.
  */
 static CgsCache *
-myCache(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId)
+myCache(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId)
 {
     CgsCache *result = 0;
 
@@ -304,7 +304,7 @@ myDisplay(XtermWidget xw)
 }
 
 static Drawable
-myDrawable(XtermWidget xw, VTwin * cgsWin)
+myDrawable(XtermWidget xw, VTwin *cgsWin)
 {
     Drawable drawable = 0;
 
@@ -316,7 +316,7 @@ myDrawable(XtermWidget xw, VTwin * cgsWin)
 }
 
 static GC
-newCache(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, CgsCache * me)
+newCache(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, CgsCache * me)
 {
     XGCValues xgcv;
     XtGCMask mask;
@@ -448,11 +448,12 @@ chgCache(XtermWidget xw, CgsEnum cgsId GCC_UNUSED, CgsCache * me, Bool both)
     THIS(used) = 0;
     return THIS(gc);
 }
+
 /*
  * Use the "setCgsXXXX()" calls to initialize parameters for a new GC.
  */
 void
-setCgsFore(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, Pixel fg)
+setCgsFore(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, Pixel fg)
 {
     CgsCache *me;
 
@@ -463,7 +464,7 @@ setCgsFore(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, Pixel fg)
 }
 
 void
-setCgsBack(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, Pixel bg)
+setCgsBack(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, Pixel bg)
 {
     CgsCache *me;
 
@@ -475,7 +476,7 @@ setCgsBack(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, Pixel bg)
 
 #if OPT_DEC_CHRSET
 void
-setCgsCSet(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, unsigned cset)
+setCgsCSet(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, unsigned cset)
 {
     CgsCache *me;
 
@@ -489,7 +490,7 @@ setCgsCSet(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, unsigned cset)
 #endif
 
 void
-setCgsFont(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, XTermFonts * font)
+setCgsFont(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, XTermFonts * font)
 {
     CgsCache *me;
 
@@ -505,8 +506,9 @@ setCgsFont(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, XTermFonts * font)
 		font = &(TScreenOf(xw)->fnts[fNorm]);
 	}
 	if (HaveFont(font) && okFont(font->fs)) {
-	    TRACE2(("...updated next font in %p for %s to %s\n",
-		    me, traceCgsEnum(cgsId), traceFont(font)));
+	    TRACE2(("setCgsFont next: %s for %s slot %p, gc %#x\n",
+		    traceFont(font), traceCgsEnum(cgsId),
+		    me, (unsigned) THIS(gc)));
 	    TRACE2(("...next font was %s\n", traceFont(NEXT(font))));
 	    NEXT(font) = font;
 	    me->mask |= GCFont;
@@ -523,7 +525,7 @@ setCgsFont(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, XTermFonts * font)
  * Keep the GC's so we can simply change them rather than creating new ones.
  */
 void
-clrCgsFonts(XtermWidget xw, VTwin * cgsWin, XTermFonts * font)
+clrCgsFonts(XtermWidget xw, VTwin *cgsWin, XTermFonts * font)
 {
     CgsCache *me;
     int j, k;
@@ -559,7 +561,7 @@ clrCgsFonts(XtermWidget xw, VTwin * cgsWin, XTermFonts * font)
  * Return a GC associated with the given id, allocating if needed.
  */
 GC
-getCgsGC(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId)
+getCgsGC(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId)
 {
     CgsCache *me;
     GC result = 0;
@@ -648,7 +650,7 @@ getCgsGC(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId)
  * Return the font for the given GC.
  */
 CgsEnum
-getCgsId(XtermWidget xw, VTwin * cgsWin, GC gc)
+getCgsId(XtermWidget xw, VTwin *cgsWin, GC gc)
 {
     int n;
     CgsEnum result = gcNorm;
@@ -670,7 +672,7 @@ getCgsId(XtermWidget xw, VTwin * cgsWin, GC gc)
  * Return the font for the given GC.
  */
 XTermFonts *
-getCgsFont(XtermWidget xw, VTwin * cgsWin, GC gc)
+getCgsFont(XtermWidget xw, VTwin *cgsWin, GC gc)
 {
     int n;
     XTermFonts *result = 0;
@@ -692,7 +694,7 @@ getCgsFont(XtermWidget xw, VTwin * cgsWin, GC gc)
  * Return the foreground color for the given GC.
  */
 Pixel
-getCgsFore(XtermWidget xw, VTwin * cgsWin, GC gc)
+getCgsFore(XtermWidget xw, VTwin *cgsWin, GC gc)
 {
     int n;
     Pixel result = 0;
@@ -714,7 +716,7 @@ getCgsFore(XtermWidget xw, VTwin * cgsWin, GC gc)
  * Return the background color for the given GC.
  */
 Pixel
-getCgsBack(XtermWidget xw, VTwin * cgsWin, GC gc)
+getCgsBack(XtermWidget xw, VTwin *cgsWin, GC gc)
 {
     int n;
     Pixel result = 0;
@@ -736,7 +738,7 @@ getCgsBack(XtermWidget xw, VTwin * cgsWin, GC gc)
  * Copy the parameters (except GC of course) from one cache record to another.
  */
 void
-copyCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
+copyCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
 {
     if (dstCgsId != srcCgsId) {
 	CgsCache *me;
@@ -801,7 +803,7 @@ redoCgs(XtermWidget xw, Pixel fg, Pixel bg, CgsEnum cgsId)
  * Swap the cache records, e.g., when doing reverse-video.
  */
 void
-swapCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
+swapCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
 {
     if (dstCgsId != srcCgsId) {
 	CgsCache *dst;
@@ -826,7 +828,7 @@ swapCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
  * Free any GC associated with the given id.
  */
 GC
-freeCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId)
+freeCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId)
 {
     CgsCache *me;
     int j;
diff --git a/charproc.c b/charproc.c
index d86fcac..eb7a118 100644
--- a/charproc.c
+++ b/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1359 2014/06/03 23:38:02 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1363 2014/06/13 00:53:14 tom Exp $ */
 
 /*
  * Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -7734,7 +7734,10 @@ VTInitialize(Widget wrequest,
     init_Ires(screen.border);
     init_Bres(screen.jumpscroll);
     init_Bres(screen.fastscroll);
+
     init_Bres(screen.old_fkeys);
+    wnew->screen.old_fkeys0 = wnew->screen.old_fkeys;
+
     init_Bres(screen.delete_is_del);
     initializeKeyboardType(wnew);
 #ifdef ALLOWLOGGING
@@ -7784,6 +7787,8 @@ VTInitialize(Widget wrequest,
     TScreenOf(wnew)->vtXX_level = (TScreenOf(wnew)->terminal_id / 100);
 
     init_Ires(screen.title_modes);
+    wnew->screen.title_modes0 = wnew->screen.title_modes;
+
     init_Bres(screen.visualbell);
     init_Bres(screen.flash_line);
     init_Ires(screen.visualBellDelay);
@@ -7837,6 +7842,7 @@ VTInitialize(Widget wrequest,
 
     TScreenOf(wnew)->pointer_cursor = TScreenOf(request)->pointer_cursor;
     init_Ires(screen.pointer_mode);
+    wnew->screen.pointer_mode0 = wnew->screen.pointer_mode;
 
     init_Sres(screen.answer_back);
 
@@ -8545,7 +8551,9 @@ VTDestroy(Widget w GCC_UNUSED)
 	XFreeCursor(screen->display, screen->hidden_cursor);
 
     xtermCloseFonts(xw, screen->fnts);
+#if OPT_WIDE_ATTRS
     xtermCloseFonts(xw, screen->ifnts);
+#endif
     noleaks_cachedCgs(xw);
 
     TRACE_FREE_LEAK(screen->selection_targets_8bit);
@@ -8615,6 +8623,7 @@ VTDestroy(Widget w GCC_UNUSED)
     TRACE_FREE_LEAK(xw->misc.default_font.f_wb);
 #endif
 
+#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS
     for (n = 0; n < NMENUFONTS; ++n) {
 	for (k = 0; k < fMAX; ++k) {
 	    if (screen->menu_font_names[n][k] !=
@@ -8626,6 +8635,7 @@ VTDestroy(Widget w GCC_UNUSED)
 	    }
 	}
     }
+#endif
 
 #if OPT_SELECT_REGEX
     for (n = 0; n < NSELECTUNITS; ++n) {
@@ -9929,6 +9939,28 @@ ShowCursor(void)
 	    XDrawLines(screen->display, VWindow(screen), outlineGC,
 		       screen->box, NBOX, CoordModePrevious);
 	} else {
+#if OPT_WIDE_ATTRS
+	    int italics_on = ((ld->attribs[cursor_col] & ATR_ITALIC) != 0);
+	    int italics_off = ((xw->flags & ATR_ITALIC) != 0);
+	    int fix_italics = (italics_on != italics_off);
+	    int which_font = (xw->flags & BOLD ? fBold : fNorm);
+
+	    if_OPT_WIDE_CHARS(screen, {
+		if (isWide((int) base)) {
+		    which_font = (xw->flags & BOLD ? fWBold : fWide);
+		}
+	    });
+
+	    if (fix_italics) {
+		xtermLoadItalics(xw);
+		if (italics_on) {
+		    setCgsFont(xw, currentWin, currentCgs, &screen->ifnts[which_font]);
+		} else {
+		    setCgsFont(xw, currentWin, currentCgs, &screen->fnts[which_font]);
+		}
+	    }
+	    currentGC = getCgsGC(xw, currentWin, currentCgs);
+#endif /* OPT_WIDE_ATTRS */
 
 	    drawXtermText(xw,
 			  flags & DRAWX_MASK,
@@ -9959,6 +9991,15 @@ ShowCursor(void)
 		XDrawLines(screen->display, VDrawable(screen), outlineGC,
 			   screen->box, NBOX, CoordModePrevious);
 	    }
+#if OPT_WIDE_ATTRS
+	    if (fix_italics) {
+		if (italics_on) {
+		    setCgsFont(xw, currentWin, currentCgs, &screen->fnts[which_font]);
+		} else {
+		    setCgsFont(xw, currentWin, currentCgs, &screen->ifnts[which_font]);
+		}
+	    }
+#endif
 	}
     }
     screen->cursor_state = ON;
@@ -9986,6 +10027,10 @@ HideCursor(void)
 #endif
     int cursor_col;
     LineData *ld = 0;
+#if OPT_WIDE_ATTRS
+    unsigned attr_flags;
+    int which_font = fNorm;
+#endif
 
     if (screen->cursor_state == OFF)
 	return;
@@ -10060,6 +10105,24 @@ HideCursor(void)
     else
 	in_selection = True;
 
+#if OPT_WIDE_ATTRS
+    attr_flags = ld->attribs[cursor_col];
+    if ((attr_flags & ATR_ITALIC) ^ (xw->flags & ATR_ITALIC)) {
+	which_font = (attr_flags & BOLD ? fBold : fNorm);
+
+	if_OPT_WIDE_CHARS(screen, {
+	    if (isWide((int) base)) {
+		which_font = (attr_flags & BOLD ? fWBold : fWide);
+	    }
+	});
+	setCgsFont(xw, WhichVWin(screen),
+		   whichXtermCgs(xw, attr_flags, in_selection),
+		   ((attr_flags & ATR_ITALIC)
+		    ? &screen->ifnts[which_font]
+		    : &screen->fnts[which_font]));
+    }
+#endif
+
     currentGC = updatedXtermGC(xw, flags, fg_bg, in_selection);
 
     TRACE(("HideCursor calling drawXtermText cur(%d,%d)\n",
@@ -10091,6 +10154,16 @@ HideCursor(void)
     });
 #endif
     screen->cursor_state = OFF;
+
+#if OPT_WIDE_ATTRS
+    if ((attr_flags & ATR_ITALIC) ^ (xw->flags & ATR_ITALIC)) {
+	setCgsFont(xw, WhichVWin(screen),
+		   whichXtermCgs(xw, xw->flags, in_selection),
+		   ((xw->flags & ATR_ITALIC)
+		    ? &screen->ifnts[which_font]
+		    : &screen->fnts[which_font]));
+    }
+#endif
     resetXtermGC(xw, flags, in_selection);
 
     refresh_displayed_graphics(screen,
@@ -10335,7 +10408,10 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved)
 
 	TabReset(xw->tabs);
 	xw->keyboard.flags = MODE_SRM;
+
+	screen->old_fkeys = screen->old_fkeys0;
 	initializeKeyboardType(xw);
+
 #if OPT_INITIAL_ERASE
 	if (xw->keyboard.reset_DECBKM == 1)
 	    xw->keyboard.flags |= MODE_DECBKM;
@@ -10349,8 +10425,8 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved)
 #if OPT_SCROLL_LOCK
 	xtermClearLEDs(screen);
 #endif
-	screen->title_modes = DEF_TITLE_MODES;
-	screen->pointer_mode = DEF_POINTER_MODE;
+	screen->title_modes = screen->title_modes0;
+	screen->pointer_mode = screen->pointer_mode0;
 #if OPT_SIXEL_GRAPHICS
 	if (TScreenOf(xw)->sixel_scrolling)
 	    xw->keyboard.flags |= MODE_DECSDM;
diff --git a/fontutils.c b/fontutils.c
index a68a247..ec6d9b1 100644
--- a/fontutils.c
+++ b/fontutils.c
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.427 2014/05/30 08:29:56 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.439 2014/06/17 20:38:27 tom Exp $ */
 
 /*
  * Copyright 1998-2013,2014 by Thomas E. Dickey
@@ -107,20 +107,20 @@
  */
 typedef struct {
     /* registry, foundry, family */
-    char *beginning;
+    const char *beginning;
     /* weight */
-    char *weight;
+    const char *weight;
     /* slant */
-    char *slant;
+    const char *slant;
     /* wideness */
-    char *wideness;
+    const char *wideness;
     /* add style */
-    char *add_style;
+    const char *add_style;
     int pixel_size;
-    char *point_size;
+    const char *point_size;
     int res_x;
     int res_y;
-    char *spacing;
+    const char *spacing;
     int average_width;
     /* charset registry, charset encoding */
     char *end;
@@ -215,7 +215,7 @@ setupPackedFonts(XtermWidget xw)
 
 /*
  * Returns the fields from start to stop in a dash- separated string.  This
- * function will modify the source, putting '\0's in the appropiate place and
+ * function will modify the source, putting '\0's in the appropriate place and
  * moving the beginning forward to after the '\0'
  *
  * This will NOT work for the last field (but we won't need it).
@@ -469,7 +469,7 @@ static char *
 italic_font_name(FontNameProperties *props, int use_average_width)
 {
     FontNameProperties myprops = *props;
-    myprops.slant = (char *) "o";
+    myprops.slant = "o";
     return derive_font_name(&myprops, props->weight, use_average_width, props->end);
 }
 #endif
@@ -630,6 +630,36 @@ got_bold_font(Display *dpy, XFontStruct *fs, String requested)
 }
 
 /*
+ * Check normal/bold (or wide/wide-bold) font pairs to see if we will be able
+ * to check for missing glyphs in a comparable manner.
+ */
+static int
+comparable_metrics(XFontStruct *normal, XFontStruct *bold)
+{
+#define DATA "comparable_metrics: "
+    int result = 0;
+
+    if (normal->all_chars_exist) {
+	if (bold->all_chars_exist) {
+	    result = 1;
+	} else {
+	    TRACE((DATA "all chars exist in normal font, but not in bold\n"));
+	}
+    } else if (normal->per_char != 0) {
+	if (bold->per_char != 0) {
+	    result = 1;
+	} else {
+	    TRACE((DATA "normal font has per-char metrics, but not bold\n"));
+	}
+    } else {
+	TRACE((DATA "normal font is not very good!\n"));
+	result = 1;		/* give in (we're not going in reverse) */
+    }
+    return result;
+#undef DATA
+}
+
+/*
  * If the font server tries to adjust another font, it may not adjust it
  * properly.  Check that the bounding boxes are compatible.  Otherwise we'll
  * leave trash on the display when we mix normal and bold fonts.
@@ -764,10 +794,10 @@ static void
 cache_menu_font_name(TScreen *screen, int fontnum, int which, const char *name)
 {
     if (name != 0) {
-	char *last = (char *) screen->menu_font_names[fontnum][which];
+	String last = screen->menu_font_names[fontnum][which];
 	if (last != 0) {
 	    if (strcmp(last, name)) {
-		free(last);
+		FREE_STRING(last);
 		TRACE(("caching menu fontname %d.%d %s\n", fontnum, which, name));
 		screen->menu_font_names[fontnum][which] = x_strdup(name);
 	    }
@@ -913,7 +943,6 @@ reportOneVTFont(const char *tag,
 {
     if (!IsEmpty(fnt->fn)) {
 	XFontStruct *fs = fnt->fs;
-	unsigned missing = 0;
 	unsigned first_char = 0;
 	unsigned last_char = 0;
 	unsigned ch;
@@ -926,12 +955,6 @@ reportOneVTFont(const char *tag,
 	    last_char = (fs->max_byte1 * 256) + fs->max_char_or_byte2;
 	}
 
-	for (ch = first_char; ch <= last_char; ++ch) {
-	    if (xtermMissingChar(ch, fnt)) {
-		++missing;
-	    }
-	}
-
 	printf("\t%s: %s\n", tag, NonNull(fnt->fn));
 	printf("\t\tall chars:     %s\n", fs->all_chars_exist ? "yes" : "no");
 	printf("\t\tdefault char:  %d\n", fs->default_char);
@@ -941,8 +964,19 @@ reportOneVTFont(const char *tag,
 	printf("\t\tfirst char:    %u\n", first_char);
 	printf("\t\tlast char:     %u\n", last_char);
 	printf("\t\tmaximum-chars: %u\n", countGlyphs(fs));
-	printf("\t\tmissing-chars: %u\n", missing);
-	printf("\t\tpresent-chars: %u\n", countGlyphs(fs) - missing);
+	if (FontLacksMetrics(fnt)) {
+	    printf("\t\tmissing-chars: ?\n");
+	    printf("\t\tpresent-chars: ?\n");
+	} else {
+	    unsigned missing = 0;
+	    for (ch = first_char; ch <= last_char; ++ch) {
+		if (xtermMissingChar(ch, fnt)) {
+		    ++missing;
+		}
+	    }
+	    printf("\t\tmissing-chars: %u\n", missing);
+	    printf("\t\tpresent-chars: %u\n", countGlyphs(fs) - missing);
+	}
 	printf("\t\tmin_byte1:     %d\n", fs->min_byte1);
 	printf("\t\tmax_byte1:     %d\n", fs->max_byte1);
 	printf("\t\tproperties:    %d\n", fs->n_properties);
@@ -1015,6 +1049,24 @@ xtermUpdateFontGCs(XtermWidget xw, XTermFonts * fnts)
     });
 }
 
+#if OPT_TRACE
+static void
+show_font_misses(const char *name, XTermFonts * fp)
+{
+    if (fp->fs != 0) {
+	if (FontLacksMetrics(fp)) {
+	    TRACE(("%s font lacks metrics\n", name));
+	} else if (FontIsIncomplete(fp)) {
+	    TRACE(("%s font is incomplete\n", name));
+	} else {
+	    TRACE(("%s font is complete\n", name));
+	}
+    } else {
+	TRACE(("%s font is missing\n", name));
+    }
+}
+#endif
+
 int
 xtermLoadFont(XtermWidget xw,
 	      const VTFontNames * fonts,
@@ -1114,7 +1166,8 @@ xtermLoadFont(XtermWidget xw,
 	if (fp == 0 || fnts[fBold].fs == 0) {
 	    xtermCopyFontInfo(&fnts[fBold], &fnts[fNorm]);
 	    TRACE(("...cannot load a matching bold font\n"));
-	} else if (same_font_size(xw, fnts[fNorm].fs, fnts[fBold].fs)
+	} else if (comparable_metrics(fnts[fNorm].fs, fnts[fBold].fs)
+		   && same_font_size(xw, fnts[fNorm].fs, fnts[fBold].fs)
 		   && got_bold_font(screen->display, fnts[fBold].fs, myfonts.f_b)) {
 	    TRACE(("...got a matching bold font\n"));
 	    cache_menu_font_name(screen, fontnum, fBold, myfonts.f_b);
@@ -1241,8 +1294,10 @@ xtermLoadFont(XtermWidget xw,
     if_OPT_WIDE_CHARS(screen, {
 	if (fnts[fWide].fs != 0
 	    && fnts[fWBold].fs != 0
-	    && !same_font_size(xw, fnts[fWide].fs, fnts[fWBold].fs)
-	    && (is_fixed_font(fnts[fWide].fs) && is_fixed_font(fnts[fWBold].fs))) {
+	    && (!comparable_metrics(fnts[fWide].fs, fnts[fWBold].fs)
+		|| (!same_font_size(xw, fnts[fWide].fs, fnts[fWBold].fs)
+		    && is_fixed_font(fnts[fWide].fs)
+		    && is_fixed_font(fnts[fWBold].fs)))) {
 	    TRACE(("...ignoring mismatched normal/bold wide fonts\n"));
 	    xtermCloseFont(xw, &fnts[fWBold]);
 	    xtermCopyFontInfo(&fnts[fWBold], &fnts[fWide]);
@@ -1329,10 +1384,15 @@ xtermLoadFont(XtermWidget xw,
     {
 	unsigned ch;
 
-	TRACE(("normal font is %scomplete\n",
-	       FontIsIncomplete(&fnts[fNorm]) ? "in" : ""));
-	TRACE(("bold font is %scomplete\n",
-	       FontIsIncomplete(&fnts[fBold]) ? "in" : ""));
+#if OPT_TRACE
+#define TRACE_MISS(index) show_font_misses(#index, &fnts[index])
+	TRACE_MISS(fNorm);
+	TRACE_MISS(fBold);
+#if OPT_WIDE_CHARS
+	TRACE_MISS(fWide);
+	TRACE_MISS(fWBold);
+#endif
+#endif
 
 	for (ch = 1; ch < 32; ch++) {
 	    unsigned n = ch;
@@ -1474,11 +1534,26 @@ xtermLoadItalics(XtermWidget xw)
 					  screen->fnts[n].fs,
 					  0)) != 0) {
 		if ((name = italic_font_name(fp, fp->average_width)) != 0) {
+		    TRACE(("xtermLoadItalics #%d %s\n", n, name));
 		    (void) xtermOpenFont(xw,
 					 name,
 					 &(screen->ifnts[n]),
 					 fwResource,
 					 False);
+#if OPT_TRACE
+		    {
+			XFontStruct *fs =
+			screen->ifnts[n].fs;
+			if (fs != 0) {
+			    TRACE(("...actual size %dx%d (ascent %d, descent %d)\n",
+				   fs->ascent +
+				   fs->descent,
+				   fs->max_bounds.width,
+				   fs->ascent,
+				   fs->descent));
+			}
+		    }
+#endif
 		    free(name);
 		}
 	    }
@@ -1527,7 +1602,18 @@ xtermLoadItalics(XtermWidget xw)
 	}
 
 #define COPY_DEFAULT_FONTS(target, source) \
-	target.default_font = source.default_font
+	xtermCopyVTFontNames(&target.default_font, &source.default_font)
+
+static void
+xtermCopyVTFontNames(VTFontNames * target, VTFontNames * source)
+{
+    target->f_n = x_strdup(source->f_n);
+    target->f_b = x_strdup(source->f_b);
+#if OPT_WIDE_CHARS
+    target->f_w = x_strdup(source->f_w);
+    target->f_wb = x_strdup(source->f_wb);
+#endif
+}
 
 void
 xtermSaveVTFonts(XtermWidget xw)
diff --git a/fontutils.h b/fontutils.h
index d60c84e..6293231 100644
--- a/fontutils.h
+++ b/fontutils.h
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.h,v 1.93 2014/05/26 16:48:15 tom Exp $ */
+/* $XTermId: fontutils.h,v 1.94 2014/06/08 21:10:27 tom Exp $ */
 
 /*
  * Copyright 1998-2013,2014 by Thomas E. Dickey
@@ -64,8 +64,8 @@ extern char *xtermSpecialFont (TScreen */* screen */, unsigned /* attr_flags */,
 
 #define FontIsIncomplete(font) \
 	((font)->fs != 0 \
-	 && ((font)->fs->per_char == 0 \
-	     || !(font)->fs->all_chars_exist))
+	 && (font)->fs->per_char != 0 \
+	 && !(font)->fs->all_chars_exist)
 
 #if OPT_BOX_CHARS
 
@@ -90,8 +90,7 @@ extern char *xtermSpecialFont (TScreen */* screen */, unsigned /* attr_flags */,
 #define IsXtermMissingChar(screen, ch, font) \
 	 (CheckedKnownMissing(font, ch) \
 	  ? ((font)->known_missing[(Char)(ch)] > 1) \
-	  : (FontLacksMetrics(font) \
-	   || (FontIsIncomplete(font) && xtermMissingChar(ch, font)) \
+	  : ((FontIsIncomplete(font) && xtermMissingChar(ch, font)) \
 	   || ForceBoxChars(screen, ch)))
 
 extern void xtermDrawBoxChar (XtermWidget /* xw */, unsigned /* ch */, unsigned /* attr_flags */, unsigned /* draw_flags */, GC /* gc */, int /* x */, int /* y */, int /* cols */);
@@ -99,7 +98,7 @@ extern void xtermDrawBoxChar (XtermWidget /* xw */, unsigned /* ch */, unsigned
 #define IsXtermMissingChar(screen, ch, font) False
 #endif
 
-#if OPT_BOX_CHARS || OPT_REPORT_FONTS 
+#if OPT_BOX_CHARS || OPT_REPORT_FONTS
 extern Bool xtermMissingChar (unsigned /* ch */, XTermFonts */* font */);
 #endif
 
diff --git a/package/debian/changelog b/package/debian/changelog
index 5defea5..15b8144 100644
--- a/package/debian/changelog
+++ b/package/debian/changelog
@@ -1,3 +1,9 @@
+xterm-dev (307) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Wed, 04 Jun 2014 18:58:36 -0400
+
 xterm-dev (306) unstable; urgency=low
 
   * fix incomplete implementation of new SGRs
diff --git a/package/freebsd/Makefile b/package/freebsd/Makefile
index 84c64c7..186e0e5 100644
--- a/package/freebsd/Makefile
+++ b/package/freebsd/Makefile
@@ -5,7 +5,7 @@
 # and "make makesum".
 
 PORTNAME=	xterm
-PORTVERSION=	306
+PORTVERSION=	307
 CATEGORIES=	x11
 MASTER_SITES=	ftp://invisible-island.net/xterm/ \
 		CRITICAL
diff --git a/package/xterm.spec b/package/xterm.spec
index 1abfe9a..7d4a4ff 100644
--- a/package/xterm.spec
+++ b/package/xterm.spec
@@ -1,11 +1,11 @@
-# $XTermId: xterm.spec,v 1.70 2014/06/03 20:25:02 tom Exp $
+# $XTermId: xterm.spec,v 1.71 2014/06/04 22:58:36 tom Exp $
 Summary: X terminal emulator (development version)
 %global my_middle xterm
 %global my_suffix -dev
 %global fullname %{my_middle}%{my_suffix}
 %global my_class XTermDev
 Name: %{fullname}
-Version: 306
+Version: 307
 Release: 1
 License: X11
 Group: User Interface/X
diff --git a/print.c b/print.c
index c3a1ab1..3c50bb5 100644
--- a/print.c
+++ b/print.c
@@ -1,4 +1,4 @@
-/* $XTermId: print.c,v 1.151 2014/05/11 10:55:11 tom Exp $ */
+/* $XTermId: print.c,v 1.152 2014/06/13 00:36:51 tom Exp $ */
 
 /*
  * Copyright 1997-2013,2014 by Thomas E. Dickey
@@ -379,6 +379,12 @@ send_SGR(XtermWidget xw, unsigned attr, unsigned fg, unsigned bg)
     strcpy(msg, "\033[0");
     if (attr & BOLD)
 	strcat(msg, ";1");
+#if OPT_WIDE_ATTRS
+    if (attr & ATR_FAINT)
+	strcat(msg, ";2");
+    if (attr & ATR_ITALIC)
+	strcat(msg, ";3");
+#endif
     if (attr & UNDERLINE)
 	strcat(msg, ";4");	/* typo? DEC documents this as '2' */
     if (attr & BLINK)
diff --git a/ptyx.h b/ptyx.h
index 05de1f9..3b30255 100644
--- a/ptyx.h
+++ b/ptyx.h
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.808 2014/05/26 15:32:29 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.809 2014/06/13 00:53:35 tom Exp $ */
 
 /*
  * Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -2027,6 +2027,7 @@ typedef struct {
 #endif /* NO_ACTIVE_ICON */
 
 	int		pointer_mode;	/* when to use hidden_cursor	*/
+	int		pointer_mode0;	/* ...initial value             */
 	Boolean 	hide_pointer;	/* true to use "hidden_cursor"  */
 	Cursor		pointer_cursor;	/* pointer cursor in window	*/
 	Cursor		hidden_cursor;	/* hidden cursor in window	*/
@@ -2173,6 +2174,7 @@ typedef struct {
 	IFlags		save_modes[DP_LAST]; /* save dec/xterm private modes */
 
 	int		title_modes;	/* control set/get of titles	*/
+	int		title_modes0;	/* ...initial value         	*/
 	SaveTitle	*save_title;
 
 	/* Improved VT100 emulation stuff.				*/
@@ -2193,6 +2195,7 @@ typedef struct {
 	Boolean		jumpscroll;	/* whether we should jumpscroll */
 	Boolean		fastscroll;	/* whether we should fastscroll */
 	Boolean		old_fkeys;	/* true for compatible fkeys	*/
+	Boolean		old_fkeys0;	/* ...initial value         	*/
 	Boolean		underline;	/* whether to underline text	*/
 
 #if OPT_MAXIMIZE
diff --git a/screen.c b/screen.c
index 842dd8b..1e52e4d 100644
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,4 @@
-/* $XTermId: screen.c,v 1.496 2014/05/26 17:54:45 tom Exp $ */
+/* $XTermId: screen.c,v 1.499 2014/06/11 18:40:34 tom Exp $ */
 
 /*
  * Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -62,7 +62,7 @@
 
 #include <X11/Xatom.h>
 
-#if OPT_WIDE_CHARS
+#if OPT_WIDE_ATTRS || OPT_WIDE_CHARS
 #include <fontutils.h>
 #endif
 
@@ -1423,7 +1423,7 @@ ScrnRefresh(XtermWidget xw,
 #endif
     static int recurse = 0;
 #if OPT_WIDE_ATTRS
-    unsigned old_attrs = 0;
+    unsigned old_attrs = xw->flags;
 #endif
 
     TRACE(("ScrnRefresh top %d (%d,%d) - (%d,%d)%s {{\n",
@@ -1766,6 +1766,9 @@ ScrnRefresh(XtermWidget xw,
      * screen foreground and background so that other functions (e.g.,
      * ClearRight) will get the correct colors.
      */
+#if OPT_WIDE_ATTRS
+    (void) refreshFontGCs(xw, xw->flags, old_attrs);
+#endif
     if_OPT_ISO_COLORS(screen, {
 	if (gc_changes & FG_COLOR)
 	    SGR_Foreground(xw, xw->cur_foreground);
diff --git a/util.c b/util.c
index 582a307..91aa6d4 100644
--- a/util.c
+++ b/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.648 2014/06/03 23:39:08 tom Exp $ */
+/* $XTermId: util.c,v 1.658 2014/06/17 23:20:43 tom Exp $ */
 
 /*
  * Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -3222,13 +3222,14 @@ drawUnderline(XtermWidget xw,
     if (screen->underline && !did_ul) {
 	int repeat = 0;
 	int descent = FontDescent(screen);
+	int length = x + (int) underline_len * font_width - 1;
 
 #if OPT_WIDE_ATTRS
 	if ((attr_flags & ATR_STRIKEOUT)) {
 	    int where = y - ((3 * FontAscent(screen)) / 8);
 	    XDrawLine(screen->display, VDrawable(screen), gc,
 		      x, where,
-		      x + (int) underline_len * font_width - 1,
+		      length,
 		      where);
 	}
 	if ((attr_flags & ATR_DBL_UNDER)) {
@@ -3239,17 +3240,65 @@ drawUnderline(XtermWidget xw,
 	    repeat = 1;
 	}
 	while (repeat-- > 0) {
-	    if (descent-- > 0)
+	    if (descent-- > 1)
 		y++;
 	    XDrawLine(screen->display, VDrawable(screen), gc,
 		      x, y,
-		      x + (int) underline_len * font_width - 1,
+		      length,
 		      y);
 	}
     }
     return y;
 }
 
+#if OPT_WIDE_ATTRS
+/*
+ * As a special case, we are currently allowing italic fonts to be inexact
+ * matches for the normal font's size.  That introduces a problem:  either the
+ * ascent or descent may be shorter, leaving a gap that has to be filled in. 
+ * Or they may be larger, requiring clipping.  Check for both cases.
+ */
+static int
+fixupItalics(XtermWidget xw,
+	     unsigned draw_flags,
+	     GC gc,
+	     XTermFonts * curFont,
+	     int y, int x,
+	     int font_width,
+	     Cardinal len)
+{
+    TScreen *screen = TScreenOf(xw);
+    VTwin *cgsWin = WhichVWin(screen);
+    XFontStruct *realFp = curFont->fs;
+    XFontStruct *thisFp = getCgsFont(xw, cgsWin, gc)->fs;
+    int need_clipping = 0;
+    int need_filling = 0;
+
+    if (thisFp->ascent > realFp->ascent)
+	need_clipping = 1;
+    else if (thisFp->ascent < realFp->ascent)
+	need_filling = 1;
+
+    if (thisFp->descent > realFp->descent)
+	need_clipping = 1;
+    else if (thisFp->descent < realFp->descent)
+	need_filling = 1;
+
+    if (need_clipping) {
+	beginClipping(screen, gc, font_width, (int) len);
+    }
+    if (need_filling) {
+	xtermFillCells(xw,
+		       draw_flags,
+		       gc,
+		       x,
+		       y - realFp->ascent,
+		       len);
+    }
+    return need_clipping;
+}
+#endif
+
 /*
  * Draws text with the specified combination of bold/underline.  The return
  * value is the updated x position.
@@ -3275,6 +3324,10 @@ drawXtermText(XtermWidget xw,
     int font_width = ((draw_flags & DOUBLEWFONT) ? 2 : 1) * screen->fnt_wide;
     Bool did_ul = False;
     XTermFonts *curFont;
+#if OPT_WIDE_ATTRS || OPT_WIDE_CHARS
+    int need_clipping = 0;
+    int ascent_adjust = 0;
+#endif
 
 #if OPT_WIDE_CHARS
     if (text == 0)
@@ -3337,6 +3390,7 @@ drawXtermText(XtermWidget xw,
 		if (nr) {
 		    xtermSetClipRectangles(screen->display, gc2,
 					   x, y, rp, nr, YXBanded);


Reply to: