"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fontutils.c" between
xterm-363.tgz and xterm-364.tgz

About: xterm is a terminal emulator for X with ISO/ANSI color and vt220 enhancements.

fontutils.c  (xterm-363.tgz):fontutils.c  (xterm-364.tgz)
/* $XTermId: fontutils.c,v 1.697 2020/11/08 20:06:01 tom Exp $ */ /* $XTermId: fontutils.c,v 1.701 2021/02/02 00:40:30 tom Exp $ */
/* /*
* Copyright 1998-2019,2020 by Thomas E. Dickey * Copyright 1998-2020,2021 by Thomas E. Dickey
* *
* All Rights Reserved * All Rights Reserved
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the * copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including * "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, * without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to * distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to * permit persons to whom the Software is furnished to do so, subject to
* the following conditions: * the following conditions:
skipping to change at line 1282 skipping to change at line 1282
if ((new_attrs & ATR_ITALIC) && !(old_attrs & ATR_ITALIC)) { if ((new_attrs & ATR_ITALIC) && !(old_attrs & ATR_ITALIC)) {
xtermLoadItalics(xw); xtermLoadItalics(xw);
xtermUpdateFontGCs(xw, getItalicFont); xtermUpdateFontGCs(xw, getItalicFont);
} else if (!(new_attrs & ATR_ITALIC) && (old_attrs & ATR_ITALIC)) { } else if (!(new_attrs & ATR_ITALIC) && (old_attrs & ATR_ITALIC)) {
xtermUpdateFontGCs(xw, getNormalFont); xtermUpdateFontGCs(xw, getNormalFont);
} }
return new_attrs; return new_attrs;
} }
#endif #endif
#if OPT_TRACE #if OPT_TRACE && OPT_BOX_CHARS
static void static void
show_font_misses(const char *name, XTermFonts * fp) show_font_misses(const char *name, XTermFonts * fp)
{ {
if (fp->fs != 0) { if (fp->fs != 0) {
if (FontLacksMetrics(fp)) { if (FontLacksMetrics(fp)) {
TRACE(("%s font lacks metrics\n", name)); TRACE(("%s font lacks metrics\n", name));
} else if (FontIsIncomplete(fp)) { } else if (FontIsIncomplete(fp)) {
TRACE(("%s font is incomplete\n", name)); TRACE(("%s font is incomplete\n", name));
} else { } else {
TRACE(("%s font is complete\n", name)); TRACE(("%s font is complete\n", name));
skipping to change at line 2422 skipping to change at line 2422
FcChar32 c; FcChar32 c;
FcChar32 first = xtermXftFirstChar(xft); FcChar32 first = xtermXftFirstChar(xft);
FcChar32 last = xtermXftLastChar(xft); FcChar32 last = xtermXftLastChar(xft);
FcChar32 dump; FcChar32 dump;
unsigned count = 0; unsigned count = 0;
unsigned too_high = 0; unsigned too_high = 0;
unsigned too_wide = 0; unsigned too_wide = 0;
Boolean skip = False; Boolean skip = False;
TRACE(("dumpXft {{\n")); TRACE(("dumpXft " TRACE_L "\n"));
TRACE(("\tdata range U+%04X..U+%04X\n", first, last)); TRACE(("\tdata range U+%04X..U+%04X\n", first, last));
TRACE(("\tcode\tcells\tdimensions\n")); TRACE(("\tcode\tcells\tdimensions\n"));
#if OPT_TRACE < 2 #if OPT_TRACE < 2
dump = 255; dump = 255;
#else #else
dump = last; dump = last;
#endif #endif
for (c = first; c <= last; ++c) { for (c = first; c <= last; ++c) {
if (FcCharSetHasChar(xft->charset, c)) { if (FcCharSetHasChar(xft->charset, c)) {
int width = CharWidth(c); int width = CharWidth(c);
skipping to change at line 2463 skipping to change at line 2463
skip = True; skip = True;
TRACE(("\t...skipping\n")); TRACE(("\t...skipping\n"));
} }
if (big_y) if (big_y)
++too_high; ++too_high;
if (big_x) if (big_x)
++too_wide; ++too_wide;
++count; ++count;
} }
} }
TRACE(("}} %u total, %u too-high, %u too-wide\n", count, too_high, too_wide) ); TRACE((TRACE_R " %u total, %u too-high, %u too-wide\n", count, too_high, too _wide));
} }
#define DUMP_XFT(xw, data) dumpXft(xw, data) #define DUMP_XFT(xw, data) dumpXft(xw, data)
#else #else
#define DUMP_XFT(xw, data) /* nothing */ #define DUMP_XFT(xw, data) /* nothing */
#endif #endif
/* /*
* Check if this is a FC_COLOR font, which fontconfig misrepresents to "fix" a * Check if this is a FC_COLOR font, which fontconfig misrepresents to "fix" a
* problem with web browsers. As of 2018/12 (4 years later), Xft does not work * problem with web browsers. As of 2018/12 (4 years later), Xft does not work
* with that. Even with this workaround, fontconfig has at least one bug which * with that. Even with this workaround, fontconfig has at least one bug which
skipping to change at line 3138 skipping to change at line 3138
pub->pattern = 0; pub->pattern = 0;
} }
if (pub->fontset) { if (pub->fontset) {
XftFontSetDestroy(pub->fontset); XftFontSetDestroy(pub->fontset);
pub->fontset = 0; pub->fontset = 0;
} }
for (n = 0; n < pub->limit; ++n) { for (n = 0; n < pub->limit; ++n) {
if (pub->cache[n].font) { if (pub->cache[n].font) {
closeCachedXft(screen, pub->cache[n].font); closeCachedXft(screen, pub->cache[n].font);
pub->cache[n].font = 0;
} }
} }
free(pub->cache);
pub->cache = NULL;
} }
} }
/* /*
* Get the faceName/faceNameDoublesize resource setting. * Get the faceName/faceNameDoublesize resource setting.
*/ */
String String
getFaceName(XtermWidget xw, Bool wideName) getFaceName(XtermWidget xw, Bool wideName)
{ {
#if OPT_RENDERWIDE #if OPT_RENDERWIDE
skipping to change at line 3570 skipping to change at line 3573
? (screen->scrollWidget->core.width + ? (screen->scrollWidget->core.width +
BorderWidth(screen->scrollWidget)) BorderWidth(screen->scrollWidget))
: 0); : 0);
xtermComputeFontInfo(xw, win, GetNormalFont(screen, fNorm)->fs, scrollbar_wi dth); xtermComputeFontInfo(xw, win, GetNormalFont(screen, fNorm)->fs, scrollbar_wi dth);
xtermSaveFontInfo(screen, GetNormalFont(screen, fNorm)->fs); xtermSaveFontInfo(screen, GetNormalFont(screen, fNorm)->fs);
if (doresize) { if (doresize) {
if (VWindow(screen)) { if (VWindow(screen)) {
xtermClear(xw); xtermClear(xw);
} }
TRACE(("xtermUpdateFontInfo {{\n")); TRACE(("xtermUpdateFontInfo " TRACE_L "\n"));
DoResizeScreen(xw); /* set to the new natural size */ DoResizeScreen(xw); /* set to the new natural size */
ResizeScrollBar(xw); ResizeScrollBar(xw);
Redraw(); Redraw();
TRACE(("... }} xtermUpdateFontInfo\n")); TRACE((TRACE_R " xtermUpdateFontInfo\n"));
#ifdef SCROLLBAR_RIGHT #ifdef SCROLLBAR_RIGHT
updateRightScrollbar(xw); updateRightScrollbar(xw);
#endif #endif
} }
xtermSetCursorBox(screen); xtermSetCursorBox(screen);
} }
#if OPT_BOX_CHARS || OPT_REPORT_FONTS #if OPT_BOX_CHARS || OPT_REPORT_FONTS
/* /*
skipping to change at line 4545 skipping to change at line 4548
/* /*
* Workaround for breakage in font-packages - check if all of the bitmap font * Workaround for breakage in font-packages - check if all of the bitmap font
* sizes are the same, and if we're using TrueType fonts. * sizes are the same, and if we're using TrueType fonts.
*/ */
static Boolean static Boolean
useFaceSizes(XtermWidget xw) useFaceSizes(XtermWidget xw)
{ {
Boolean result = False; Boolean result = False;
TRACE(("useFaceSizes {{\n")); TRACE(("useFaceSizes " TRACE_L "\n"));
if (UsingRenderFont(xw)) { if (UsingRenderFont(xw)) {
Boolean nonzero = True; Boolean nonzero = True;
int n; int n;
for (n = 0; n < NMENU_RENDERFONTS; ++n) { for (n = 0; n < NMENU_RENDERFONTS; ++n) {
if (xw->misc.face_size[n] <= 0.0f) { if (xw->misc.face_size[n] <= 0.0f) {
nonzero = False; nonzero = False;
break; break;
} }
} }
skipping to change at line 4582 skipping to change at line 4585
TRACE(("bitmap fonts are broken - set faceSize resources\n")); TRACE(("bitmap fonts are broken - set faceSize resources\n"));
for (n = 0; n < NMENUFONTS; n++) { for (n = 0; n < NMENUFONTS; n++) {
fillInFaceSize(xw, n); fillInFaceSize(xw, n);
} }
} }
} }
result = True; result = True;
} }
TRACE(("...}}useFaceSizes %d\n", result)); TRACE((TRACE_R " useFaceSizes %d\n", result));
return result; return result;
} }
#endif /* OPT_RENDERFONT */ #endif /* OPT_RENDERFONT */
#if OPT_SHIFT_FONTS #if OPT_SHIFT_FONTS
/* /*
* Find the index of a larger/smaller font (according to the sign of 'relative' * Find the index of a larger/smaller font (according to the sign of 'relative'
* and its magnitude), starting from the 'old' index. * and its magnitude), starting from the 'old' index.
*/ */
int int
skipping to change at line 4759 skipping to change at line 4762
fontnum = fontMenu_fontescape; fontnum = fontMenu_fontescape;
break; break;
case 's': case 's':
case 'S': case 'S':
fontnum = fontMenu_fontsel; fontnum = fontMenu_fontsel;
break; break;
default: default:
fontnum = -1; fontnum = -1;
break; break;
} }
TRACE(("xtermGetFont(%s) ->%d\n", NonNull(param), fontnum));
return fontnum; return fontnum;
} }
/* ARGSUSED */ /* ARGSUSED */
void void
HandleSetFont(Widget w, HandleSetFont(Widget w,
XEvent *event GCC_UNUSED, XEvent *event GCC_UNUSED,
String *params, String *params,
Cardinal *param_count) Cardinal *param_count)
{ {
 End of changes. 12 change blocks. 
9 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)