Fri Nov 19 23:05:31 PST 1999 Michael Jennings <mej@eterm.org>

Once again, I've rendered old themes obselete. :-)

	I added a new config file attribute and command-line parameter.  The
	option is --default-font-index, but I wouldn't necessarily use it.
	The config file attribute makes more sense. :-)

	Anyway, your themes will now need to have a line like this:

	    font default <index>

	in the attributes section.  This tells Eterm which font it should use
	on startup.  (<index> is a number between 0 and the highest-numbered
	font you define.)  You can now have up to 256 fonts.  Font 0 is no
	longer necessarily the default font; it is the smallest font.  And the
	larger the font index, the larger the font should be.  (Of course,
	this assumes you want Ctrl-> and Ctrl-< to increase/decrease your font
	size.  In reality, you can have your fonts in any order, and those
	keys will cycle through them in order.)

	Before, font 0 was always the default, and you didn't have much
	freedom in rearranging your fonts.  Plus, you were limited to 5.  Not
	any more. :-)  The new system is much more straight-forward, logical,
	and powerful.

	So please be sure to update your themes by hand, or remove your theme
	directory before installing this new version.  If your theme lacks
	the "font default" line, your Eterms will start with the wrong font.
	:-]


SVN revision: 1344
eterm-0.10
Michael Jennings 24 years ago
parent eeab8b0a87
commit c00ecb143c
  1. 32
      ChangeLog
  2. 1
      acconfig.h
  3. 34
      configure.in
  4. 2
      libmej/mem.h
  5. 36
      src/command.c
  6. 2
      src/events.c
  7. 147
      src/font.c
  8. 43
      src/font.h
  9. 2
      src/menus.c
  10. 33
      src/options.c
  11. 8
      src/term.c
  12. 9
      themes/Eterm/theme.cfg.in
  13. 9
      themes/auto/theme.cfg.in
  14. 9
      themes/cEterm/theme.cfg.in
  15. 9
      themes/chooser/theme.cfg.in
  16. 9
      themes/emacs/theme.cfg.in
  17. 15
      themes/irc/theme.cfg.in
  18. 9
      themes/mutt/theme.cfg.in
  19. 9
      themes/trans/theme.cfg.in

@ -2820,3 +2820,35 @@ Fri Nov 19 18:43:58 PST 1999 Michael Jennings <mej@eterm.org>
occurances of calls to the old scrollbar_show() function.
-------------------------------------------------------------------------------
Fri Nov 19 23:05:31 PST 1999 Michael Jennings <mej@eterm.org>
Once again, I've rendered old themes obselete. :-)
I added a new config file attribute and command-line parameter. The
option is --default-font-index, but I wouldn't necessarily use it.
The config file attribute makes more sense. :-)
Anyway, your themes will now need to have a line like this:
font default <index>
in the attributes section. This tells Eterm which font it should use
on startup. (<index> is a number between 0 and the highest-numbered
font you define.) You can now have up to 256 fonts. Font 0 is no
longer necessarily the default font; it is the smallest font. And the
larger the font index, the larger the font should be. (Of course,
this assumes you want Ctrl-> and Ctrl-< to increase/decrease your font
size. In reality, you can have your fonts in any order, and those
keys will cycle through them in order.)
Before, font 0 was always the default, and you didn't have much
freedom in rearranging your fonts. Plus, you were limited to 5. Not
any more. :-) The new system is much more straight-forward, logical,
and powerful.
So please be sure to update your themes by hand, or remove your theme
directory before installing this new version. If your theme lacks
the "font default" line, your Eterms will start with the wrong font.
:-]
-------------------------------------------------------------------------------

@ -320,6 +320,7 @@
#undef FONT2
#undef FONT3
#undef FONT4
#undef DEF_FONT_IDX
/* Leave that blank line there!! Autoheader needs it.

@ -289,6 +289,7 @@ AC_ARG_ENABLE(multi-charset,
if test "$enableval" = "yes" -o "$enableval" = "kanji"; then
AC_MSG_RESULT(kanji)
AC_DEFINE(MULTI_CHARSET)
AC_DEFINE_UNQUOTED(DEF_FONT_IDX, 0)
AC_DEFINE_UNQUOTED(MFONT0, "k14")
AC_DEFINE_UNQUOTED(MFONT1, "jiskan16")
AC_DEFINE_UNQUOTED(MFONT2, "jiskan18")
@ -302,29 +303,32 @@ AC_ARG_ENABLE(multi-charset,
elif test "$enableval" = "utf-8"; then
AC_MSG_RESULT(utf-8)
AC_DEFINE(MULTI_CHARSET)
AC_DEFINE_UNQUOTED(DEF_FONT_IDX, 2)
AC_DEFINE_UNQUOTED(MFONT0, "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")
AC_DEFINE_UNQUOTED(MFONT1, "-misc-fixed-medium-r-normal--7-70-75-75-c-50-iso10646-1")
AC_DEFINE_UNQUOTED(MFONT2, "-misc-fixed-medium-r-normal--10-100-75-75-c-60-iso10646-1")
AC_DEFINE_UNQUOTED(MFONT3, "-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1")
AC_DEFINE_UNQUOTED(MFONT4, "-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso10646-1")
AC_DEFINE_UNQUOTED(FONT0, "fixed")
AC_DEFINE_UNQUOTED(FONT1, "5x7")
AC_DEFINE_UNQUOTED(FONT2, "6x10")
AC_DEFINE_UNQUOTED(FONT3, "7x14")
AC_DEFINE_UNQUOTED(FONT4, "8x13")
AC_DEFINE_UNQUOTED(FONT0, "5x7")
AC_DEFINE_UNQUOTED(FONT1, "6x10")
AC_DEFINE_UNQUOTED(FONT2, "fixed")
AC_DEFINE_UNQUOTED(FONT3, "8x13")
AC_DEFINE_UNQUOTED(FONT4, "9x15")
else
AC_MSG_RESULT(no)
AC_DEFINE_UNQUOTED(FONT0, "fixed")
AC_DEFINE_UNQUOTED(FONT1, "5x7")
AC_DEFINE_UNQUOTED(FONT2, "6x10")
AC_DEFINE_UNQUOTED(FONT3, "7x14")
AC_DEFINE_UNQUOTED(FONT4, "8x13")
AC_DEFINE_UNQUOTED(DEF_FONT_IDX, 2)
AC_DEFINE_UNQUOTED(FONT0, "5x7")
AC_DEFINE_UNQUOTED(FONT1, "6x10")
AC_DEFINE_UNQUOTED(FONT2, "fixed")
AC_DEFINE_UNQUOTED(FONT3, "8x13")
AC_DEFINE_UNQUOTED(FONT4, "9x15")
fi, AC_MSG_RESULT(no)
AC_DEFINE_UNQUOTED(FONT0, "fixed")
AC_DEFINE_UNQUOTED(FONT1, "5x7")
AC_DEFINE_UNQUOTED(FONT2, "6x10")
AC_DEFINE_UNQUOTED(FONT3, "7x14")
AC_DEFINE_UNQUOTED(FONT4, "8x13")
AC_DEFINE_UNQUOTED(DEF_FONT_IDX, 2)
AC_DEFINE_UNQUOTED(FONT0, "5x7")
AC_DEFINE_UNQUOTED(FONT1, "6x10")
AC_DEFINE_UNQUOTED(FONT2, "fixed")
AC_DEFINE_UNQUOTED(FONT3, "8x13")
AC_DEFINE_UNQUOTED(FONT4, "9x15")
)
AC_MSG_CHECKING(for XIM support)
AC_ARG_ENABLE(xim,

@ -55,7 +55,7 @@ typedef struct memrec_struct {
# define MALLOC(sz) malloc(sz)
# define CALLOC(type,n) calloc((n),(sizeof(type)))
# define REALLOC(mem,sz) ((sz) ? ((mem) ? (realloc((mem), (sz))) : (malloc(sz))) : ((mem) ? (free(mem)) : (NULL)))
# define FREE(ptr) free(ptr)
# define FREE(ptr) do { free(ptr); ptr = NULL; } while(0)
#endif
extern char *SafeStr(char *, unsigned short);

@ -1652,25 +1652,21 @@ create_fontset(const char *font1, const char *font2)
ASSERT(font1 != NULL);
#ifdef MULTI_CHARSET
if (!font2) {
font2 = "*";
}
fontname = MALLOC(strlen(font1) + strlen(font2) + sizeof(fs_base) + 2);
if (fontname) {
strcpy(fontname, font1);
strcat(fontname, fs_base);
strcat(fontname, ",");
strcat(fontname, font2);
}
#else
font2 = NULL;
fontname = MALLOC(strlen(font1) + sizeof(fs_base) + 1);
if (fontname) {
strcpy(fontname, font1);
strcat(fontname, fs_base);
if (font2) {
fontname = MALLOC(strlen(font1) + strlen(font2) + sizeof(fs_base) + 2);
if (fontname) {
strcpy(fontname, font1);
strcat(fontname, ",");
strcat(fontname, font2);
strcat(fontname, fs_base);
}
} else {
fontname = MALLOC(strlen(font1) + sizeof(fs_base) + 1);
if (fontname) {
strcpy(fontname, font1);
strcat(fontname, fs_base);
}
}
#endif
if (fontname) {
setlocale(LC_ALL, "");
fontset = XCreateFontSet(Xdisplay, fontname, &ml, &mc, &ds);
@ -1703,9 +1699,9 @@ init_locale(void)
print_error("Setting locale failed.");
} else {
#ifdef MULTI_CHARSET
TermWin.fontset = create_fontset(rs_font[0], rs_mfont[0]);
TermWin.fontset = create_fontset(etfonts[0], rs_mfont[0]);
#else
TermWin.fontset = create_fontset(rs_font[0], (const char *) NULL);
TermWin.fontset = create_fontset(etfonts[0], "-misc-fixed-medium-r-semicondensed--13-*-75-*-c-*-iso10646-1");
#endif
#ifdef USE_XIM
# ifdef MULTI_CHARSET

@ -436,10 +436,12 @@ handle_configure_notify(event_t * ev)
D_EVENTS((" -> TermWin.parent is %ldx%ld at (%d, %d). Internal cache data shows %dx%d at (%hd, %hd)\n",
width, height, x, y, szHint.width, szHint.height, TermWin.x, TermWin.y));
#if 0
/* If the font change count is non-zero, this event is telling us we resized ourselves. */
if (font_change_count > 0) {
font_change_count--;
}
#endif
if ((width != (unsigned int) szHint.width) || (height != (unsigned int) szHint.height)) {
/* We were resized externally. Handle the resize. */
D_EVENTS((" -> External resize detected.\n"));

@ -45,26 +45,73 @@ static const char cvs_ident[] = "$Id$";
#include "term.h"
#include "windows.h"
unsigned char font_change_count = 0;
char **etfonts = NULL;
unsigned char font_idx = DEF_FONT_IDX, def_font_idx = DEF_FONT_IDX, font_cnt = 0;
char *rs_font[NFONTS];
#ifdef MULTI_CHARSET
char *rs_mfont[NFONTS];
const char *def_mfontName[] = {MFONT0, MFONT1, MFONT2, MFONT3, MFONT4};
#endif
const char *def_fontName[] = {FONT0, FONT1, FONT2, FONT3, FONT4};
static etfont_t *font_cache = NULL, *cur_font = NULL;
static cachefont_t *font_cache = NULL, *cur_font = NULL;
static void font_cache_add(const char *name, unsigned char type, void *info);
static void font_cache_del(const void *info);
static etfont_t *font_cache_find(const char *name, unsigned char type);
static cachefont_t *font_cache_find(const char *name, unsigned char type);
static void *font_cache_find_info(const char *name, unsigned char type);
void
eterm_font_add(char ***plist, const char *fontname, unsigned char idx) {
char **flist = *plist;
D_FONT(("eterm_font_add(\"%s\", %u): plist == %8p\n", NONULL(fontname), (unsigned int) idx, plist));
ASSERT(plist != NULL);
if (idx >= font_cnt) {
unsigned char new_size = sizeof(char *) * (idx + 1);
if (flist) {
*plist = (char **) REALLOC(*plist, new_size);
D_FONT((" -> Reallocating flist to a size of %u bytes gives %8p\n", new_size, *plist));
} else {
*plist = (char **) MALLOC(new_size);
D_FONT((" -> Allocating flist with a size of %u bytes gives %8p\n", new_size, *plist));
}
flist = *plist;
MEMSET(flist + font_cnt, 0, sizeof(char *) * (idx - font_cnt));
font_cnt = idx + 1;
} else {
if (flist[idx]) {
if ((flist[idx] == fontname) || (!strcasecmp(flist[idx], fontname))) {
return;
}
FREE(flist[idx]);
}
}
flist[idx] = StrDup(fontname);
DUMP_FONTS();
}
void
eterm_font_delete(char **flist, unsigned char idx) {
ASSERT(idx < font_cnt);
if (flist[idx]) {
FREE(flist[idx]);
}
flist[idx] = NULL;
}
static void
font_cache_add(const char *name, unsigned char type, void *info) {
etfont_t *font;
cachefont_t *font;
D_FONT(("font_cache_add(%s, %d, %8p) called.\n", NONULL(name), type, info));
font = (etfont_t *) MALLOC(sizeof(etfont_t));
font = (cachefont_t *) MALLOC(sizeof(cachefont_t));
font->name = StrDup(name);
font->type = type;
font->ref_cnt = 1;
@ -88,7 +135,7 @@ font_cache_add(const char *name, unsigned char type, void *info) {
static void
font_cache_del(const void *info) {
etfont_t *current, *tmp;
cachefont_t *current, *tmp;
D_FONT(("font_cache_del(%8p) called.\n", info));
@ -132,10 +179,10 @@ font_cache_del(const void *info) {
}
}
static etfont_t *
static cachefont_t *
font_cache_find(const char *name, unsigned char type) {
etfont_t *current;
cachefont_t *current;
ASSERT_RVAL(name != NULL, NULL);
@ -149,13 +196,13 @@ font_cache_find(const char *name, unsigned char type) {
}
}
D_FONT(("font_cache_find(): No matches found. =(\n"));
return ((etfont_t *) NULL);
return ((cachefont_t *) NULL);
}
static void *
font_cache_find_info(const char *name, unsigned char type) {
etfont_t *current;
cachefont_t *current;
ASSERT_RVAL(name != NULL, NULL);
@ -181,7 +228,7 @@ void *
load_font(const char *name, const char *fallback, unsigned char type)
{
etfont_t *font;
cachefont_t *font;
XFontStruct *xfont;
D_FONT(("load_font(%s, %s, %d) called.\n", NONULL(name), NONULL(fallback), type));
@ -195,7 +242,11 @@ load_font(const char *name, const char *fallback, unsigned char type)
fallback = "fixed";
} else {
name = "fixed";
#ifdef MULTI_CHARSET
fallback = "-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso10646-1";
#else
fallback = "-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1";
#endif
}
} else if (fallback == NULL) {
fallback = "fixed";
@ -247,69 +298,70 @@ change_font(int init, const char *fontname)
#ifndef NO_BOLDFONT
static XFontStruct *boldFont = NULL;
#endif
static short fnum = FONT0_IDX;
short idx = 0;
int fh, fw = 0;
register unsigned long i;
register int cw;
if (!init) {
D_FONT(("change_font(%d, \"%s\"): def_font_idx == %u, font_idx == %u\n", init, NONULL(fontname), (unsigned int) def_font_idx, (unsigned int) font_idx));
if (init) {
font_idx = def_font_idx;
ASSERT(etfonts != NULL);
ASSERT(etfonts[font_idx] != NULL);
} else {
ASSERT(fontname != NULL);
switch (fontname[0]) {
switch (*fontname) {
case '\0':
fnum = FONT0_IDX;
font_idx = def_font_idx;
fontname = NULL;
break;
/* special (internal) prefix for font commands */
case FONT_CMD:
idx = atoi(fontname + 1);
switch (fontname[1]) {
case '+': /* corresponds to FONT_UP */
fnum += (idx ? idx : 1);
fnum = FNUM_RANGE(fnum);
idx = atoi(++fontname);
switch (*fontname) {
case '+':
NEXT_FONT(idx);
break;
case '-': /* corresponds to FONT_DN */
fnum += (idx ? idx : -1);
fnum = FNUM_RANGE(fnum);
case '-':
PREV_FONT(idx);
break;
default:
if (fontname[1] != '\0' && !isdigit(fontname[1]))
if (*fontname != '\0' && !isdigit(*fontname))
return;
if (idx < 0 || idx >= (NFONTS))
return;
fnum = IDX2FNUM(idx);
BOUND(idx, 0, (font_cnt - 1));
font_idx = idx;
break;
}
fontname = NULL;
break;
default:
for (idx = 0; idx < NFONTS; idx++) {
if (!strcmp(rs_font[idx], fontname)) {
fnum = IDX2FNUM(idx);
for (idx = 0; idx < font_cnt; idx++) {
if (!strcasecmp(etfonts[idx], fontname)) {
font_idx = idx;
fontname = NULL;
break;
}
}
break;
}
idx = FNUM2IDX(fnum);
if ((fontname != NULL) && strcasecmp(rs_font[idx], fontname)) {
RESET_AND_ASSIGN(rs_font[idx], StrDup(fontname));
if (fontname != NULL) {
eterm_font_add(&etfonts, fontname, font_idx);
}
}
D_FONT((" -> Changing to font index %u (\"%s\")\n", (unsigned int) font_idx, NONULL(etfonts[font_idx])));
if (TermWin.font) {
if (font_cache_find_info(rs_font[idx], FONT_TYPE_X) != TermWin.font) {
if (font_cache_find_info(etfonts[font_idx], FONT_TYPE_X) != TermWin.font) {
free_font(TermWin.font);
TermWin.font = load_font(rs_font[idx], "fixed", FONT_TYPE_X);
TermWin.font = load_font(etfonts[font_idx], "fixed", FONT_TYPE_X);
}
} else {
TermWin.font = load_font(rs_font[idx], "fixed", FONT_TYPE_X);
TermWin.font = load_font(etfonts[font_idx], "fixed", FONT_TYPE_X);
}
#ifndef NO_BOLDFONT
@ -332,7 +384,7 @@ change_font(int init, const char *fontname)
if (TermWin.fontset) {
XFreeFontSet(Xdisplay, TermWin.fontset);
}
TermWin.fontset = create_fontset(rs_font[idx], rs_mfont[idx]);
TermWin.fontset = create_fontset(etfonts[font_idx], rs_mfont[idx]);
xim_set_fontset();
}
# endif
@ -392,19 +444,18 @@ change_font(int init, const char *fontname)
TermWin.width = TermWin.ncol * TermWin.fwidth;
TermWin.height = TermWin.nrow * TermWin.fheight;
szHint.width_inc = TermWin.fwidth;
szHint.height_inc = TermWin.fheight;
if (init) {
szHint.width_inc = TermWin.fwidth;
szHint.height_inc = TermWin.fheight;
szHint.min_width = szHint.base_width + szHint.width_inc;
szHint.min_height = szHint.base_height + szHint.height_inc;
szHint.min_width = szHint.base_width + szHint.width_inc;
szHint.min_height = szHint.base_height + szHint.height_inc;
szHint.width = szHint.base_width + TermWin.width;
szHint.height = szHint.base_height + TermWin.height;
szHint.width = szHint.base_width + TermWin.width;
szHint.height = szHint.base_height + TermWin.height;
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
if (!init) {
font_change_count++;
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
} else {
parent_resize();
}
return;

@ -31,41 +31,40 @@
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
/************ Macros and Definitions ************/
#define FONT_TYPE_X (0x01)
#define FONT_TYPE_TTF (0x02)
#define FONT_TYPE_FNLIB (0x03)
#define FONT_TYPE_X (0x01)
#define FONT_TYPE_TTF (0x02)
#define FONT_TYPE_FNLIB (0x03)
#define font_cache_add_ref(font) ((font)->ref_cnt++)
# define NFONTS 5
/* special (internal) prefix for font commands */
# define FONT_CMD '#'
# define FONT_DN "#-"
# define FONT_UP "#+"
#if (FONT0_IDX == 0)
# define IDX2FNUM(i) (i)
# define FNUM2IDX(f) (f)
#else
# define IDX2FNUM(i) (i == 0? FONT0_IDX : (i <= FONT0_IDX? (i-1) : i))
# define FNUM2IDX(f) (f == FONT0_IDX ? 0 : (f < FONT0_IDX ? (f+1) : f))
#endif
#define FNUM_RANGE(i) (i <= 0 ? 0 : (i >= NFONTS ? (NFONTS-1) : i))
#define NFONTS 5
#define FONT_CMD '#'
#define BIGGER_FONT "#+"
#define SMALLER_FONT "#-"
#define NEXT_FONT(i) do { if (font_idx + ((i)?(i):1) >= font_cnt) {font_idx = font_cnt - 1;} else {font_idx += ((i)?(i):1);} \
while (!etfonts[font_idx]) {if (font_idx == font_cnt) {font_idx--; break;} font_idx++;} } while (0)
#define PREV_FONT(i) do { if (font_idx - ((i)?(i):1) < 0) {font_idx = 0;} else {font_idx -= ((i)?(i):1);} \
while (!etfonts[font_idx]) {if (font_idx == 0) break; font_idx--;} } while (0)
#define DUMP_FONTS() do {unsigned char i; D_FONT(("DUMP_FONTS(): Font count is %u\n", (unsigned int) font_cnt)); \
for (i = 0; i < font_cnt; i++) {D_FONT(("DUMP_FONTS(): Font %u == \"%s\"\n", (unsigned int) i, NONULL(etfonts[i])));}} while (0)
/************ Structures ************/
typedef struct font_struct {
typedef struct cachefont_struct {
char *name;
unsigned char type;
unsigned char ref_cnt;
union {
XFontStruct *xfontinfo;
} fontinfo;
struct font_struct *next;
} etfont_t;
struct cachefont_struct *next;
} cachefont_t;
/************ Variables ************/
extern unsigned char font_change_count;
extern unsigned char font_idx, def_font_idx, font_cnt;
extern const char *def_fontName[];
extern char *rs_font[NFONTS];
extern char **etfonts;
# ifdef MULTI_CHARSET
extern const char *def_mfontName[];
extern char *rs_mfont[NFONTS];
@ -74,6 +73,8 @@ extern char *rs_mfont[NFONTS];
/************ Function Prototypes ************/
_XFUNCPROTOBEGIN
extern void eterm_font_add(char ***plist, const char *fontname, unsigned char idx);
extern void eterm_font_delete(char **flist, unsigned char idx);
extern void *load_font(const char *, const char *, unsigned char);
extern void free_font(const void *);
extern void change_font(int, const char *);

@ -843,7 +843,7 @@ menu_draw(menu_t * menu)
scr = ScreenOfDisplay(Xdisplay, Xscreen);
if (!menu->font) {
menu_set_font(menu, rs_font[0]);
menu_set_font(menu, etfonts[def_font_idx]);
}
gcvalue.foreground = PixColors[menuTextColor];
XChangeGC(Xdisplay, menu->gc, GCForeground, &gcvalue);

@ -199,10 +199,6 @@ char *rs_name = NULL;
#ifndef NO_BOLDFONT
char *rs_boldFont = NULL;
#endif
char *rs_font[NFONTS];
#ifdef MULTI_CHARSET
char *rs_mfont[NFONTS];
#endif
#ifdef PRINTPIPE
char *rs_print_pipe = NULL;
#endif
@ -331,6 +327,7 @@ static const struct {
OPT_LONG("bold-font", "bold text font", &rs_boldFont),
#endif
OPT_STR('F', "font", "normal text font", &rs_font[0]),
OPT_ILONG("default-font-index", "set the index of the default font", &def_font_idx),
OPT_LONG("font1", "font 1", &rs_font[1]),
OPT_LONG("font2", "font 2", &rs_font[2]),
OPT_LONG("font3", "font 3", &rs_font[3]),
@ -1793,8 +1790,8 @@ parse_attributes(char *buff)
}
if (isdigit(*tmp)) {
n = (unsigned char) strtoul(tmp, (char **) NULL, 0);
if (n <= 4) {
RESET_AND_ASSIGN(rs_font[n], Word(2, tmp));
if (n <= 255) {
eterm_font_add(&etfonts, PWord(2, tmp), n);
} else {
print_error("Parse error in file %s, line %lu: Invalid font index %d",
file_peek_path(), file_peek_line(), n);
@ -1806,6 +1803,9 @@ parse_attributes(char *buff)
print_warning("Support for the bold font attribute was not compiled in, ignoring");
#endif
} else if (!BEG_STRCASECMP(tmp, "default ")) {
def_font_idx = strtoul(PWord(2, tmp), (char **) NULL, 0);
} else {
tmp = Word(1, tmp);
print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"",
@ -3075,6 +3075,7 @@ read_config(char *conf_name)
void
init_defaults(void)
{
unsigned char i;
rs_name = StrDup(APL_NAME " " VERSION);
@ -3107,7 +3108,10 @@ init_defaults(void)
#ifndef NO_BRIGHTCOLOR
colorfgbg = DEFAULT_RSTYLE;
#endif
MEMSET(rs_font, 0, sizeof(char *) * NFONTS);
for (i = 0; i < NFONTS; i++) {
eterm_font_add(&etfonts, def_fontName[i], i);
}
TermWin.internalBorder = DEFAULT_BORDER_WIDTH;
}
@ -3173,8 +3177,14 @@ post_parse(void)
}
#endif
for (i = 0; i < NFONTS; i++) {
if (!rs_font[i]) {
rs_font[i] = StrDup(def_fontName[i]);
if (rs_font[i]) {
if (def_font_idx == 0) {
eterm_font_add(&etfonts, rs_font[i], i);
RESET_AND_ASSIGN(rs_font[i], NULL);
} else {
eterm_font_add(&etfonts, rs_font[i], ((i == 0) ? def_font_idx : ((i <= def_font_idx) ? (i - 1) : i)));
RESET_AND_ASSIGN(rs_font[i], NULL);
}
}
#ifdef MULTI_CHARSET
if (!rs_mfont[i]) {
@ -3457,8 +3467,9 @@ save_config(char *path)
}
fprintf(fp, " scrollbar_type %s\n", (scrollbar_get_type() == SCROLLBAR_XTERM ? "xterm" : (scrollbar_get_type() == SCROLLBAR_MOTIF ? "motif" : "next")));
fprintf(fp, " scrollbar_width %d\n", scrollbar_anchor_width());
for (i = 0; i < 5; i++) {
fprintf(fp, " font %d %s\n", i, rs_font[i]);
fprintf(fp, " font default %u\n", (unsigned int) font_idx);
for (i = 0; i < font_cnt; i++) {
fprintf(fp, " font %d %s\n", i, etfonts[i]);
}
#ifndef NO_BOLDFONT
if (rs_boldFont) {

@ -190,10 +190,10 @@ lookup_key(XEvent * ev)
/* for some backwards compatibility */
if (HOTKEY) {
if (keysym == ks_bigfont) {
change_font(0, FONT_UP);
change_font(0, BIGGER_FONT);
LK_RET();
} else if (keysym == ks_smallfont) {
change_font(0, FONT_DN);
change_font(0, SMALLER_FONT);
LK_RET();
}
}
@ -236,12 +236,12 @@ lookup_key(XEvent * ev)
break;
case XK_KP_Add: /* Shift+KP_Add = bigger font */
change_font(0, FONT_UP);
change_font(0, BIGGER_FONT);
LK_RET();
break;
case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */
change_font(0, FONT_DN);
change_font(0, SMALLER_FONT);
LK_RET();
break;
}

@ -82,11 +82,14 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 fixed
font 1 5x7
font 2 6x10
font default 2
font 0 5x7
font 1 6x10
font 2 fixed
font 3 8x13
font 4 9x15
font 5 10x20
font 6 12x24
# font bold 7x14
end attributes

@ -82,11 +82,14 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 fixed
font 1 5x7
font 2 6x10
font default 2
font 0 5x7
font 1 6x10
font 2 fixed
font 3 8x13
font 4 9x15
font 5 10x20
font 6 12x24
# font bold 7x14
end attributes

@ -81,11 +81,14 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 fixed
font 1 5x7
font 2 6x10
font default 2
font 0 5x7
font 1 6x10
font 2 fixed
font 3 8x13
font 4 9x15
font 5 10x20
font 6 12x24
# font bold 7x14
end attributes

@ -82,11 +82,14 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 fixed
font 1 5x7
font 2 6x10
font default 2
font 0 5x7
font 1 6x10
font 2 fixed
font 3 8x13
font 4 9x15
font 5 10x20
font 6 12x24
# font bold 7x14
end attributes

@ -82,11 +82,14 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 fixed
font 1 5x7
font 2 6x10
font default 2
font 0 5x7
font 1 6x10
font 2 fixed
font 3 8x13
font 4 9x15
font 5 10x20
font 6 12x24
# font bold 7x14
end attributes

@ -82,11 +82,16 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 shine
font 1 nexus
font 2 fixed
font 3 7x14
font 4 8x13
font default 2
font 0 5x7
font 1 6x10
font 2 shine
font 3 nexus
font 4 fixed
font 5 8x13
font 6 9x15
font 7 10x20
font 8 12x24
# font bold 7x14
end attributes

@ -82,11 +82,14 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 fixed
font 1 5x7
font 2 6x10
font default 2
font 0 5x7
font 1 6x10
font 2 fixed
font 3 8x13
font 4 9x15
font 5 10x20
font 6 12x24
# font bold 7x14
end attributes

@ -82,11 +82,14 @@ begin main
# the Eterm defaults. The "bold" font is the font used if color BD has
# not been set and Eterm cannot map the foreground color to one of the
# high-intensity colors (8-15).
font 0 fixed
font 1 5x7
font 2 6x10
font default 2
font 0 5x7
font 1 6x10
font 2 fixed
font 3 8x13
font 4 9x15
font 5 10x20
font 6 12x24
# font bold 7x14
end attributes

Loading…
Cancel
Save