Source-Changes-HG archive

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

[xsrc/trunk]: xsrc/external/mit/xterm/dist merge xterm 382.



details:   https://anonhg.NetBSD.org/xsrc/rev/627319f23733
branches:  trunk
changeset: 7567:627319f23733
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Jun 20 02:07:22 2023 +0000

description:
merge xterm 382.

diffstat:

 external/mit/xterm/dist/XTerm.ad         |     2 +-
 external/mit/xterm/dist/fontutils.c      |  1498 +++++++++++++++++++----------
 external/mit/xterm/dist/graphics_sixel.c |   129 +-
 external/mit/xterm/dist/linedata.c       |     4 +-
 external/mit/xterm/dist/misc.c           |   369 ++++--
 external/mit/xterm/dist/ptyx.h           |   132 +-
 external/mit/xterm/dist/resize.c         |    51 +-
 external/mit/xterm/dist/run-tic.sh       |   138 --
 external/mit/xterm/dist/scrollback.c     |     2 +-
 external/mit/xterm/dist/xterm.h          |    51 +-
 external/mit/xterm/dist/xterm.man        |   223 +++-
 11 files changed, 1589 insertions(+), 1010 deletions(-)

diffs (truncated from 4905 to 300 lines):

diff -r 42c86bfaab1a -r 627319f23733 external/mit/xterm/dist/XTerm.ad
--- a/external/mit/xterm/dist/XTerm.ad  Tue Jun 20 02:01:59 2023 +0000
+++ b/external/mit/xterm/dist/XTerm.ad  Tue Jun 20 02:07:22 2023 +0000
@@ -1,4 +1,4 @@
-! $XTermId: XTerm.ad,v 1.106 2021/02/03 01:02:03 tom Exp $
+! $XTermId: XTerm.ad,v 1.105 2021/01/26 20:40:37 tom Exp $
 ! -----------------------------------------------------------------------------
 ! this file is part of xterm
 !
diff -r 42c86bfaab1a -r 627319f23733 external/mit/xterm/dist/fontutils.c
--- a/external/mit/xterm/dist/fontutils.c       Tue Jun 20 02:01:59 2023 +0000
+++ b/external/mit/xterm/dist/fontutils.c       Tue Jun 20 02:07:22 2023 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: fontutils.c,v 1.712 2022/02/23 00:46:08 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.773 2023/05/08 00:00:38 tom Exp $ */
 
 /*
- * Copyright 1998-2021,2022 by Thomas E. Dickey
+ * Copyright 1998-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -51,6 +51,16 @@
 #include <stdio.h>
 #include <ctype.h>
 
+#define USE_FC_COLOR 0
+#if OPT_RENDERFONT
+#if XftVersion > 20304
+#undef USE_FC_COLOR
+#define USE_FC_COLOR 1
+#endif
+#endif
+
+#define FcOK(func) (func == FcResultMatch)
+
 #define NoFontWarning(data) (data)->warn = fwAlways
 
 #define SetFontWidth(screen,dst,src)  (dst)->f_width = (src)
@@ -92,9 +102,9 @@
 }
 
 #define FREE_FNAME(field) \
-           if (fonts == 0 || myfonts.field != fonts->field) { \
-               FREE_STRING(myfonts.field); \
-               myfonts.field = 0; \
+           if (fonts == 0 || new_fnames.field != fonts->field) { \
+               FREE_STRING(new_fnames.field); \
+               new_fnames.field = 0; \
            }
 
 /*
@@ -153,14 +163,30 @@ static Boolean merge_sublist(char ***, c
 #endif
 
 static void save2FontList(XtermWidget, const char *, XtermFontNames *,
-                         VTFontEnum, const char *, Bool);
+                         VTFontEnum, const char *, Bool, Bool);
 
 #if OPT_RENDERFONT
 static void fillInFaceSize(XtermWidget, int);
 #endif
 
-#if OPT_SHIFT_FONTS
-static int lookupOneFontSize(XtermWidget, int);
+#if OPT_REPORT_FONTS && OPT_TRACE
+static void
+report_fonts(const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    vfprintf(stdout, fmt, ap);
+    va_end(ap);
+#if OPT_TRACE
+    va_start(ap, fmt);
+    TraceVA(fmt, ap);
+    va_end(ap);
+#endif
+}
+
+#define ReportFonts report_fonts
+#else
+#define ReportFonts printf
 #endif
 
 #if OPT_TRACE
@@ -240,7 +266,7 @@ setupPackedFonts(XtermWidget xw)
        for (e = 0; e < fMAX; ++e) {
            XTermXftFonts *data = getMyXftFont(xw, e, screen->menu_font_number);
            if (data != 0) {
-               if (data->map.mixed) {
+               if (data->font_info.mixed) {
                    screen->allow_packing = True;
                    break;
                }
@@ -559,7 +585,7 @@ italic_font_name(FontNameProperties *pro
 static Boolean
 open_italic_font(XtermWidget xw, int n, FontNameProperties *fp, XTermFonts * data)
 {
-    static const char *slant[] =
+    static const char *const slant[] =
     {
        "o",
        "i"
@@ -573,13 +599,13 @@ open_italic_font(XtermWidget xw, int n, 
        if ((name = italic_font_name(fp, slant[pass])) != 0) {
            TRACE(("open_italic_font %s %s\n",
                   whichFontEnum((VTFontEnum) n), name));
-           if (xtermOpenFont(xw, name, data, False)) {
+           if (xtermOpenFont(xw, name, data, NULL, False)) {
                result = (data->fs != 0);
 #if OPT_REPORT_FONTS
                if (resource.reportFonts) {
-                   printf("opened italic version of %s:\n\t%s\n",
-                          whichFontEnum((VTFontEnum) n),
-                          name);
+                   ReportFonts("opened italic version of %s:\n\t%s\n",
+                               whichFontEnum((VTFontEnum) n),
+                               name);
                }
 #endif
            }
@@ -1037,20 +1063,26 @@ xtermLoadQueryFont(XtermWidget xw, const
 }
 
 /*
- * Open the given font and verify that it is non-empty.  Return a null on
+ * Open the given font and verify that it is non-empty.  Return false on
  * failure.
  */
 Bool
 xtermOpenFont(XtermWidget xw,
              const char *name,
              XTermFonts * result,
+             XTermFonts * current,
              Bool force)
 {
     Bool code = False;
 
     TRACE(("xtermOpenFont %d:%d '%s'\n",
           result->warn, xw->misc.fontWarnings, NonNull(name)));
+
     if (!IsEmpty(name)) {
+       Bool existing = (current != NULL
+                        && current->fs != NULL
+                        && current->fn != NULL);
+
        if ((result->fs = xtermLoadQueryFont(xw, name)) != 0) {
            code = True;
            if (EmptyFont(result->fs)) {
@@ -1069,9 +1101,13 @@ xtermOpenFont(XtermWidget xw,
            } else {
                TRACE(("xtermOpenFont: cannot load font '%s'\n", name));
            }
-           if (force) {
+           if (existing) {
+               TRACE(("...continue using font '%s'\n", current->fn));
+               result->fn = x_strdup(current->fn);
+               result->fs = current->fs;
+           } else if (force) {
                NoFontWarning(result);
-               code = xtermOpenFont(xw, DEFFONT, result, True);
+               code = xtermOpenFont(xw, DEFFONT, result, NULL, True);
            }
        }
     }
@@ -1157,12 +1193,12 @@ xtermFreeFontInfo(XTermFonts * target)
 static void
 reportXCharStruct(const char *tag, XCharStruct * cs)
 {
-    printf("\t\t%s:\n", tag);
-    printf("\t\t\tlbearing: %d\n", cs->lbearing);
-    printf("\t\t\trbearing: %d\n", cs->rbearing);
-    printf("\t\t\twidth:    %d\n", cs->width);
-    printf("\t\t\tascent:   %d\n", cs->ascent);
-    printf("\t\t\tdescent:  %d\n", cs->descent);
+    ReportFonts("\t\t%s:\n", tag);
+    ReportFonts("\t\t\tlbearing: %d\n", cs->lbearing);
+    ReportFonts("\t\t\trbearing: %d\n", cs->rbearing);
+    ReportFonts("\t\t\twidth:    %d\n", cs->width);
+    ReportFonts("\t\t\tascent:   %d\n", cs->ascent);
+    ReportFonts("\t\t\tdescent:  %d\n", cs->descent);
 }
 
 static void
@@ -1182,18 +1218,20 @@ reportOneVTFont(const char *tag,
            last_char = (fs->max_byte1 * 256) + fs->max_char_or_byte2;
        }
 
-       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);
-       printf("\t\tdirection:     %d\n", fs->direction);
-       printf("\t\tascent:        %d\n", fs->ascent);
-       printf("\t\tdescent:       %d\n", fs->descent);
-       printf("\t\tfirst char:    %u\n", first_char);
-       printf("\t\tlast char:     %u\n", last_char);
-       printf("\t\tmaximum-chars: %u\n", countGlyphs(fs));
+       ReportFonts("\t%s: %s\n", tag, NonNull(fnt->fn));
+       ReportFonts("\t\tall chars:     %s\n", (fs->all_chars_exist
+                                               ? "yes"
+                                               : "no"));
+       ReportFonts("\t\tdefault char:  %u\n", fs->default_char);
+       ReportFonts("\t\tdirection:     %u\n", fs->direction);
+       ReportFonts("\t\tascent:        %d\n", fs->ascent);
+       ReportFonts("\t\tdescent:       %d\n", fs->descent);
+       ReportFonts("\t\tfirst char:    %u\n", first_char);
+       ReportFonts("\t\tlast char:     %u\n", last_char);
+       ReportFonts("\t\tmaximum-chars: %u\n", countGlyphs(fs));
        if (FontLacksMetrics(fnt)) {
-           printf("\t\tmissing-chars: ?\n");
-           printf("\t\tpresent-chars: ?\n");
+           ReportFonts("\t\tmissing-chars: ?\n");
+           ReportFonts("\t\tpresent-chars: ?\n");
        } else {
            unsigned missing = 0;
            unsigned ch;
@@ -1202,12 +1240,12 @@ reportOneVTFont(const char *tag,
                    ++missing;
                }
            }
-           printf("\t\tmissing-chars: %u\n", missing);
-           printf("\t\tpresent-chars: %u\n", countGlyphs(fs) - missing);
+           ReportFonts("\t\tmissing-chars: %u\n", missing);
+           ReportFonts("\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);
+       ReportFonts("\t\tmin_byte1:     %u\n", fs->min_byte1);
+       ReportFonts("\t\tmax_byte1:     %u\n", fs->max_byte1);
+       ReportFonts("\t\tproperties:    %d\n", fs->n_properties);
        reportXCharStruct("min_bounds", &(fs->min_bounds));
        reportXCharStruct("max_bounds", &(fs->max_bounds));
        /* TODO: report fs->properties and fs->per_char */
@@ -1221,9 +1259,9 @@ reportVTFontInfo(XtermWidget xw, int fon
        TScreen *screen = TScreenOf(xw);
 
        if (fontnum) {
-           printf("Loaded VTFonts(font%d)\n", fontnum);
+           ReportFonts("Loaded VTFonts(font%d)\n", fontnum);
        } else {
-           printf("Loaded VTFonts(default)\n");
+           ReportFonts("Loaded VTFonts(default)\n");
        }
 
        reportOneVTFont("fNorm", GetNormalFont(screen, fNorm));
@@ -1321,6 +1359,7 @@ static Bool
 loadNormFP(XtermWidget xw,
           char **nameOutP,
           XTermFonts * infoOut,
+          XTermFonts * current,
           int fontnum)
 {
     Bool status = True;
@@ -1330,7 +1369,7 @@ loadNormFP(XtermWidget xw,
     if (!xtermOpenFont(xw,
                       *nameOutP,
                       infoOut,
-                      (fontnum == fontMenu_default))) {
+                      current, (fontnum == fontMenu_default))) {
        /*
         * If we are opening the default font, and it happens to be missing,
         * force that to the compiled-in default font, e.g., "fixed".  If we
@@ -1365,10 +1404,10 @@ loadBoldFP(XtermWidget xw,
        if (fp != 0) {
            NoFontWarning(infoOut);
            *nameOutP = bold_font_name(fp, fp->average_width);
-           if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) {
+           if (!xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)) {
                free(*nameOutP);
                *nameOutP = bold_font_name(fp, -1);
-               xtermOpenFont(xw, *nameOutP, infoOut, False);
+               xtermOpenFont(xw, *nameOutP, infoOut, NULL, False);
            }
            TRACE(("...derived bold '%s'\n", NonNull(*nameOutP)));
        }
@@ -1386,7 +1425,7 @@ loadBoldFP(XtermWidget xw,
            TRACE(("...did not get a matching bold font\n"));
        }
        free(normal);
-    } else if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) {
+    } else if (!xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)) {
        xtermCopyFontInfo(infoOut, infoRef);
        TRACE(("...cannot load bold font '%s'\n", NonNull(*nameOutP)));
     } else {
@@ -1440,7 +1479,7 @@ loadWideFP(XtermWidget xw,
     }
 
     if (check_fontname(*nameOutP)) {
-       if (xtermOpenFont(xw, *nameOutP, infoOut, False)
+       if (xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)
            && is_derived_font_name(*nameOutP)
            && EmptyFont(infoOut->fs)) {
            xtermCloseFont2(xw, infoOut - fWide, fWide);
@@ -1493,7 +1532,7 @@ loadWBoldFP(XtermWidget xw,
 
     if (check_fontname(*nameOutP)) {
 
-       if (xtermOpenFont(xw, *nameOutP, infoOut, False)



Home | Main Index | Thread Index | Old Index