1999-09-21 19:34:13 -07:00
|
|
|
/* font.c -- Eterm font module
|
|
|
|
*
|
|
|
|
* This file is original work by Michael Jennings <mej@eterm.org> and
|
|
|
|
* Tuomo Venalainen <vendu@cc.hut.fi>. This file, and any other file
|
|
|
|
* bearing this same message or a similar one, is distributed under
|
|
|
|
* the GNU Public License (GPL) as outlined in the COPYING file.
|
|
|
|
*
|
1999-10-07 15:18:14 -07:00
|
|
|
* Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen
|
1999-09-21 19:34:13 -07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const char cvs_ident[] = "$Id$";
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "feature.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
#include "../libmej/debug.h"
|
|
|
|
#include "../libmej/mem.h"
|
|
|
|
#include "../libmej/strings.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "font.h"
|
1999-10-07 15:18:14 -07:00
|
|
|
#include "startup.h"
|
1999-09-21 19:34:13 -07:00
|
|
|
#include "options.h"
|
|
|
|
#include "screen.h"
|
|
|
|
#include "term.h"
|
|
|
|
#include "windows.h"
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
char **etfonts = NULL;
|
|
|
|
unsigned char font_idx = DEF_FONT_IDX, def_font_idx = DEF_FONT_IDX, font_cnt = 0;
|
|
|
|
char *rs_font[NFONTS];
|
1999-09-21 19:34:13 -07:00
|
|
|
#ifdef MULTI_CHARSET
|
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
1999-11-19 21:17:29 -08:00
|
|
|
char *rs_mfont[NFONTS];
|
1999-12-02 18:31:33 -08:00
|
|
|
char **etmfonts = NULL;
|
1999-09-21 19:34:13 -07:00
|
|
|
const char *def_mfontName[] = {MFONT0, MFONT1, MFONT2, MFONT3, MFONT4};
|
|
|
|
#endif
|
|
|
|
const char *def_fontName[] = {FONT0, FONT1, FONT2, FONT3, FONT4};
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
static cachefont_t *font_cache = NULL, *cur_font = NULL;
|
1999-09-21 19:34:13 -07:00
|
|
|
static void font_cache_add(const char *name, unsigned char type, void *info);
|
|
|
|
static void font_cache_del(const void *info);
|
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
1999-11-19 21:17:29 -08:00
|
|
|
static cachefont_t *font_cache_find(const char *name, unsigned char type);
|
1999-09-22 15:15:46 -07:00
|
|
|
static void *font_cache_find_info(const char *name, unsigned char type);
|
1999-09-21 19:34:13 -07:00
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
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);
|
|
|
|
|
1999-12-10 18:06:33 -08:00
|
|
|
if (etfonts) {
|
|
|
|
etfonts = (char **) REALLOC(etfonts, new_size);
|
|
|
|
#ifdef MULTI_CHARSET
|
|
|
|
etmfonts = (char **) REALLOC(etmfonts, new_size);
|
|
|
|
#endif
|
|
|
|
D_FONT((" -> Reallocating fonts lists to a size of %u bytes gives %8p/%8p\n", new_size, etfonts, etmfonts));
|
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
1999-11-19 21:17:29 -08:00
|
|
|
} else {
|
1999-12-10 18:06:33 -08:00
|
|
|
etfonts = (char **) MALLOC(new_size);
|
|
|
|
#ifdef MULTI_CHARSET
|
|
|
|
etmfonts = (char **) MALLOC(new_size);
|
|
|
|
#endif
|
|
|
|
D_FONT((" -> Allocating fonts lists to a size of %u bytes gives %8p/%8p\n", new_size, etfonts, etmfonts));
|
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
1999-11-19 21:17:29 -08:00
|
|
|
}
|
1999-12-10 18:06:33 -08:00
|
|
|
MEMSET(etfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
|
|
|
|
#ifdef MULTI_CHARSET
|
|
|
|
MEMSET(etmfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
|
|
|
|
#endif
|
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
1999-11-19 21:17:29 -08:00
|
|
|
font_cnt = idx + 1;
|
1999-12-10 18:06:33 -08:00
|
|
|
#ifdef MULTI_CHARSET
|
|
|
|
flist = ((plist == &etfonts) ? (etfonts) : (etmfonts));
|
|
|
|
#else
|
|
|
|
flist = etfonts;
|
|
|
|
#endif
|
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
1999-11-19 21:17:29 -08:00
|
|
|
} 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;
|
|
|
|
}
|
|
|
|
|
1999-09-21 19:34:13 -07:00
|
|
|
static void
|
|
|
|
font_cache_add(const char *name, unsigned char type, void *info) {
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
cachefont_t *font;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
1999-10-27 06:39:30 -07:00
|
|
|
D_FONT(("font_cache_add(%s, %d, %8p) called.\n", NONULL(name), type, info));
|
1999-09-21 19:34:13 -07:00
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
font = (cachefont_t *) MALLOC(sizeof(cachefont_t));
|
1999-09-21 19:34:13 -07:00
|
|
|
font->name = StrDup(name);
|
|
|
|
font->type = type;
|
|
|
|
font->ref_cnt = 1;
|
|
|
|
switch (type) {
|
|
|
|
case FONT_TYPE_X: font->fontinfo.xfontinfo = (XFontStruct *) info; break;
|
|
|
|
case FONT_TYPE_TTF: break;
|
|
|
|
case FONT_TYPE_FNLIB: break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (font_cache == NULL) {
|
|
|
|
font_cache = cur_font = font;
|
|
|
|
font->next = NULL;
|
|
|
|
} else {
|
|
|
|
cur_font->next = font;
|
|
|
|
font->next = NULL;
|
|
|
|
cur_font = font;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
font_cache_del(const void *info) {
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
cachefont_t *current, *tmp;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
1999-10-27 06:39:30 -07:00
|
|
|
D_FONT(("font_cache_del(%8p) called.\n", info));
|
1999-09-21 19:34:13 -07:00
|
|
|
|
|
|
|
if (font_cache == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (((font_cache->type == FONT_TYPE_X) && (font_cache->fontinfo.xfontinfo == (XFontStruct *) info))) {
|
1999-10-27 06:39:30 -07:00
|
|
|
D_FONT((" -> Match found at font_cache (%8p). Font name is \"%s\"\n", font_cache, NONULL(font_cache->name)));
|
1999-09-21 19:34:13 -07:00
|
|
|
if (--(font_cache->ref_cnt) == 0) {
|
|
|
|
D_FONT((" -> Reference count is now 0. Deleting from cache.\n"));
|
|
|
|
current = font_cache;
|
|
|
|
font_cache = current->next;
|
|
|
|
XFreeFont(Xdisplay, (XFontStruct *) info);
|
|
|
|
FREE(current->name);
|
|
|
|
FREE(current);
|
|
|
|
} else {
|
|
|
|
D_FONT((" -> Reference count is %d. Returning.\n", font_cache->ref_cnt));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else if ((font_cache->type == FONT_TYPE_TTF) && (0)) {
|
|
|
|
} else if ((font_cache->type == FONT_TYPE_FNLIB) && (0)) {
|
|
|
|
} else {
|
|
|
|
for (current = font_cache; current->next; current = current->next) {
|
|
|
|
if (((current->next->type == FONT_TYPE_X) && (current->next->fontinfo.xfontinfo == (XFontStruct *) info))) {
|
1999-10-27 06:39:30 -07:00
|
|
|
D_FONT((" -> Match found at current->next (%8p, current == %8p). Font name is \"%s\"\n", current->next, current, NONULL(current->next->name)));
|
1999-09-21 19:34:13 -07:00
|
|
|
if (--(current->next->ref_cnt) == 0) {
|
|
|
|
D_FONT((" -> Reference count is now 0. Deleting from cache.\n"));
|
|
|
|
tmp = current->next;
|
|
|
|
current->next = current->next->next;
|
|
|
|
XFreeFont(Xdisplay, (XFontStruct *) info);
|
|
|
|
FREE(tmp->name);
|
|
|
|
FREE(tmp);
|
|
|
|
} else {
|
|
|
|
D_FONT((" -> Reference count is %d. Returning.\n", font_cache->ref_cnt));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else if ((current->next->type == FONT_TYPE_TTF) && (0)) {
|
|
|
|
} else if ((current->next->type == FONT_TYPE_FNLIB) && (0)) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
static cachefont_t *
|
1999-09-21 19:34:13 -07:00
|
|
|
font_cache_find(const char *name, unsigned char type) {
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
cachefont_t *current;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
|
|
|
ASSERT_RVAL(name != NULL, NULL);
|
|
|
|
|
|
|
|
D_FONT(("font_cache_find(%s, %d) called.\n", NONULL(name), type));
|
|
|
|
|
|
|
|
for (current = font_cache; current; current = current->next) {
|
1999-10-27 06:39:30 -07:00
|
|
|
D_FONT((" -> Checking current (%8p), type == %d, name == %s\n", current, current->type, NONULL(current->name)));
|
1999-09-21 19:34:13 -07:00
|
|
|
if ((current->type == type) && !strcasecmp(current->name, name)) {
|
|
|
|
D_FONT((" -> Match!\n"));
|
|
|
|
return (current);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
D_FONT(("font_cache_find(): No matches found. =(\n"));
|
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
1999-11-19 21:17:29 -08:00
|
|
|
return ((cachefont_t *) NULL);
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
1999-09-22 15:15:46 -07:00
|
|
|
|
|
|
|
static void *
|
|
|
|
font_cache_find_info(const char *name, unsigned char type) {
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
cachefont_t *current;
|
1999-09-22 15:15:46 -07:00
|
|
|
|
1999-12-10 18:06:33 -08:00
|
|
|
REQUIRE_RVAL(name != NULL, NULL);
|
1999-09-22 15:15:46 -07:00
|
|
|
|
|
|
|
D_FONT(("font_cache_find_info(%s, %d) called.\n", NONULL(name), type));
|
|
|
|
|
|
|
|
for (current = font_cache; current; current = current->next) {
|
1999-10-27 06:39:30 -07:00
|
|
|
D_FONT((" -> Checking current (%8p), type == %d, name == %s\n", current, current->type, NONULL(current->name)));
|
1999-09-22 15:15:46 -07:00
|
|
|
if ((current->type == type) && !strcasecmp(current->name, name)) {
|
|
|
|
D_FONT((" -> Match!\n"));
|
|
|
|
switch (type) {
|
|
|
|
case FONT_TYPE_X: return ((void *) current->fontinfo.xfontinfo); break;
|
|
|
|
case FONT_TYPE_TTF: return (NULL); break;
|
|
|
|
case FONT_TYPE_FNLIB: return (NULL); break;
|
|
|
|
default: return (NULL); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
D_FONT(("font_cache_find_info(): No matches found. =(\n"));
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
1999-09-21 19:34:13 -07:00
|
|
|
void *
|
|
|
|
load_font(const char *name, const char *fallback, unsigned char type)
|
|
|
|
{
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
cachefont_t *font;
|
1999-09-21 19:34:13 -07:00
|
|
|
XFontStruct *xfont;
|
|
|
|
|
1999-09-22 15:15:46 -07:00
|
|
|
D_FONT(("load_font(%s, %s, %d) called.\n", NONULL(name), NONULL(fallback), type));
|
|
|
|
|
1999-09-21 19:34:13 -07:00
|
|
|
if (type == 0) {
|
|
|
|
type = FONT_TYPE_X;
|
|
|
|
}
|
|
|
|
if (name == NULL) {
|
|
|
|
if (fallback) {
|
|
|
|
name = fallback;
|
|
|
|
fallback = "fixed";
|
|
|
|
} else {
|
|
|
|
name = "fixed";
|
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
1999-11-19 21:17:29 -08:00
|
|
|
#ifdef MULTI_CHARSET
|
|
|
|
fallback = "-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso10646-1";
|
|
|
|
#else
|
1999-09-21 19:34:13 -07:00
|
|
|
fallback = "-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1";
|
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
1999-11-19 21:17:29 -08:00
|
|
|
#endif
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
|
|
|
} else if (fallback == NULL) {
|
|
|
|
fallback = "fixed";
|
|
|
|
}
|
1999-09-22 15:15:46 -07:00
|
|
|
D_FONT((" -> Using name == \"%s\" and fallback == \"%s\"\n", name, fallback));
|
|
|
|
|
1999-09-21 19:34:13 -07:00
|
|
|
if ((font = font_cache_find(name, type)) != NULL) {
|
|
|
|
font_cache_add_ref(font);
|
1999-09-22 15:15:46 -07:00
|
|
|
D_FONT((" -> Font found in cache. Incrementing reference count to %d and returning existing data.\n", font->ref_cnt));
|
1999-09-21 19:34:13 -07:00
|
|
|
switch (type) {
|
|
|
|
case FONT_TYPE_X: return ((void *) font->fontinfo.xfontinfo); break;
|
|
|
|
case FONT_TYPE_TTF: return (NULL); break;
|
|
|
|
case FONT_TYPE_FNLIB: return (NULL); break;
|
|
|
|
default: return (NULL); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type == FONT_TYPE_X) {
|
|
|
|
if ((xfont = XLoadQueryFont(Xdisplay, name)) == NULL) {
|
|
|
|
print_error("Unable to load font \"%s\". Falling back on \"%s\"\n", name, fallback);
|
|
|
|
if ((xfont = XLoadQueryFont(Xdisplay, fallback)) == NULL) {
|
|
|
|
fatal_error("Couldn't load the fallback font either. Giving up.");
|
|
|
|
} else {
|
|
|
|
font_cache_add(fallback, type, (void *) xfont);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
font_cache_add(name, type, (void *) xfont);
|
|
|
|
}
|
|
|
|
return ((void *) xfont);
|
|
|
|
} else if (type == FONT_TYPE_TTF) {
|
|
|
|
return (NULL);
|
|
|
|
} else if (type == FONT_TYPE_FNLIB) {
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
ASSERT_NOTREACHED_RVAL(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
free_font(const void *info)
|
|
|
|
{
|
|
|
|
|
|
|
|
ASSERT(info != NULL);
|
|
|
|
|
|
|
|
font_cache_del(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
change_font(int init, const char *fontname)
|
|
|
|
{
|
|
|
|
#ifndef NO_BOLDFONT
|
|
|
|
static XFontStruct *boldFont = NULL;
|
|
|
|
#endif
|
|
|
|
short idx = 0;
|
1999-09-22 15:15:46 -07:00
|
|
|
int fh, fw = 0;
|
|
|
|
register unsigned long i;
|
|
|
|
register int cw;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
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);
|
1999-12-02 18:31:33 -08:00
|
|
|
#ifdef MULTI_CHARSET
|
|
|
|
ASSERT(etmfonts != NULL);
|
|
|
|
ASSERT(etmfonts[font_idx] != NULL);
|
|
|
|
#endif
|
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
1999-11-19 21:17:29 -08:00
|
|
|
} else {
|
1999-09-21 19:34:13 -07:00
|
|
|
ASSERT(fontname != NULL);
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
switch (*fontname) {
|
1999-09-21 19:34:13 -07:00
|
|
|
case '\0':
|
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
1999-11-19 21:17:29 -08:00
|
|
|
font_idx = def_font_idx;
|
1999-09-21 19:34:13 -07:00
|
|
|
fontname = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* special (internal) prefix for font commands */
|
|
|
|
case FONT_CMD:
|
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
1999-11-19 21:17:29 -08:00
|
|
|
idx = atoi(++fontname);
|
|
|
|
switch (*fontname) {
|
|
|
|
case '+':
|
|
|
|
NEXT_FONT(idx);
|
1999-09-21 19:34:13 -07:00
|
|
|
break;
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
case '-':
|
|
|
|
PREV_FONT(idx);
|
1999-09-21 19:34:13 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
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
1999-11-19 21:17:29 -08:00
|
|
|
if (*fontname != '\0' && !isdigit(*fontname))
|
1999-09-21 19:34:13 -07:00
|
|
|
return;
|
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
1999-11-19 21:17:29 -08:00
|
|
|
BOUND(idx, 0, (font_cnt - 1));
|
|
|
|
font_idx = idx;
|
1999-09-21 19:34:13 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
fontname = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
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
1999-11-19 21:17:29 -08:00
|
|
|
for (idx = 0; idx < font_cnt; idx++) {
|
|
|
|
if (!strcasecmp(etfonts[idx], fontname)) {
|
|
|
|
font_idx = idx;
|
1999-09-22 15:15:46 -07:00
|
|
|
fontname = NULL;
|
|
|
|
break;
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
1999-09-22 15:15:46 -07:00
|
|
|
}
|
1999-09-21 19:34:13 -07:00
|
|
|
break;
|
|
|
|
}
|
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
1999-11-19 21:17:29 -08:00
|
|
|
if (fontname != NULL) {
|
|
|
|
eterm_font_add(&etfonts, fontname, font_idx);
|
1999-09-22 15:15:46 -07:00
|
|
|
}
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
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
1999-11-19 21:17:29 -08:00
|
|
|
D_FONT((" -> Changing to font index %u (\"%s\")\n", (unsigned int) font_idx, NONULL(etfonts[font_idx])));
|
1999-09-21 19:34:13 -07:00
|
|
|
if (TermWin.font) {
|
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
1999-11-19 21:17:29 -08:00
|
|
|
if (font_cache_find_info(etfonts[font_idx], FONT_TYPE_X) != TermWin.font) {
|
1999-09-22 15:15:46 -07:00
|
|
|
free_font(TermWin.font);
|
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
1999-11-19 21:17:29 -08:00
|
|
|
TermWin.font = load_font(etfonts[font_idx], "fixed", FONT_TYPE_X);
|
1999-09-22 15:15:46 -07:00
|
|
|
}
|
|
|
|
} else {
|
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
1999-11-19 21:17:29 -08:00
|
|
|
TermWin.font = load_font(etfonts[font_idx], "fixed", FONT_TYPE_X);
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef NO_BOLDFONT
|
|
|
|
if (init && rs_boldFont != NULL) {
|
|
|
|
boldFont = load_font(rs_boldFont, "-misc-fixed-bold-r-semicondensed--13-120-75-75-c-60-iso8859-1", FONT_TYPE_X);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MULTI_CHARSET
|
|
|
|
if (TermWin.mfont) {
|
1999-12-02 18:31:33 -08:00
|
|
|
if (font_cache_find_info(etmfonts[font_idx], FONT_TYPE_X) != TermWin.mfont) {
|
1999-09-22 15:15:46 -07:00
|
|
|
free_font(TermWin.mfont);
|
1999-12-02 18:31:33 -08:00
|
|
|
TermWin.mfont = load_font(etmfonts[font_idx], "k14", FONT_TYPE_X);
|
1999-09-22 15:15:46 -07:00
|
|
|
}
|
|
|
|
} else {
|
1999-12-02 18:31:33 -08:00
|
|
|
TermWin.mfont = load_font(etmfonts[font_idx], "k14", FONT_TYPE_X);
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
|
|
|
# ifdef USE_XIM
|
1999-11-19 15:21:09 -08:00
|
|
|
if (xim_input_context) {
|
1999-09-21 19:34:13 -07:00
|
|
|
if (TermWin.fontset) {
|
|
|
|
XFreeFontSet(Xdisplay, TermWin.fontset);
|
|
|
|
}
|
1999-12-02 18:31:33 -08:00
|
|
|
TermWin.fontset = create_fontset(etfonts[font_idx], etmfonts[font_idx]);
|
1999-09-21 19:34:13 -07:00
|
|
|
xim_set_fontset();
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif /* MULTI_CHARSET */
|
|
|
|
|
|
|
|
if (!init) {
|
|
|
|
XSetFont(Xdisplay, TermWin.gc, TermWin.font->fid);
|
|
|
|
}
|
|
|
|
|
1999-09-22 15:15:46 -07:00
|
|
|
fw = TermWin.font->min_bounds.width;
|
|
|
|
fh = TermWin.font->ascent + TermWin.font->descent + rs_line_space;
|
|
|
|
|
|
|
|
D_FONT(("Font information: Ascent == %hd, Descent == %hd\n", TermWin.font->ascent, TermWin.font->descent));
|
|
|
|
if (TermWin.font->min_bounds.width == TermWin.font->max_bounds.width)
|
|
|
|
TermWin.fprop = 0; /* Mono-spaced (fixed width) font */
|
|
|
|
else
|
|
|
|
TermWin.fprop = 1; /* Proportional font */
|
|
|
|
if (TermWin.fprop == 1)
|
|
|
|
for (i = TermWin.font->min_char_or_byte2; i <= TermWin.font->max_char_or_byte2; i++) {
|
|
|
|
cw = TermWin.font->per_char[i].width;
|
|
|
|
MAX_IT(fw, cw);
|
|
|
|
}
|
|
|
|
/* not the first time thru and sizes haven't changed */
|
|
|
|
if (fw == TermWin.fwidth && fh == TermWin.fheight)
|
|
|
|
return; /* TODO: not return; check MULTI_CHARSET if needed */
|
|
|
|
|
|
|
|
TermWin.fwidth = fw;
|
|
|
|
TermWin.fheight = fh;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
|
|
|
/* check that size of boldFont is okay */
|
|
|
|
#ifndef NO_BOLDFONT
|
|
|
|
TermWin.boldFont = NULL;
|
|
|
|
if (boldFont != NULL) {
|
|
|
|
|
|
|
|
fw = boldFont->min_bounds.width;
|
|
|
|
fh = boldFont->ascent + boldFont->descent + rs_line_space;
|
|
|
|
if (TermWin.fprop == 0) { /* bold font must also be monospaced */
|
|
|
|
if (fw != boldFont->max_bounds.width)
|
|
|
|
fw = -1;
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
if (!isprint(i))
|
|
|
|
continue;
|
|
|
|
cw = boldFont->per_char[i].width;
|
|
|
|
MAX_IT(fw, cw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-09-22 15:15:46 -07:00
|
|
|
if (fw == TermWin.fwidth && fh == TermWin.fheight) {
|
1999-09-21 19:34:13 -07:00
|
|
|
TermWin.boldFont = boldFont;
|
1999-09-22 15:15:46 -07:00
|
|
|
}
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
|
|
|
#endif /* NO_BOLDFONT */
|
|
|
|
|
|
|
|
set_colorfgbg();
|
|
|
|
|
|
|
|
TermWin.width = TermWin.ncol * TermWin.fwidth;
|
|
|
|
TermWin.height = TermWin.nrow * TermWin.fheight;
|
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
if (init) {
|
|
|
|
szHint.width_inc = TermWin.fwidth;
|
|
|
|
szHint.height_inc = TermWin.fheight;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
szHint.min_width = szHint.base_width + szHint.width_inc;
|
|
|
|
szHint.min_height = szHint.base_height + szHint.height_inc;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
szHint.width = szHint.base_width + TermWin.width;
|
|
|
|
szHint.height = szHint.base_height + TermWin.height;
|
1999-09-21 19:34:13 -07:00
|
|
|
|
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
1999-11-19 21:17:29 -08:00
|
|
|
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
|
|
|
|
} else {
|
1999-10-11 11:37:55 -07:00
|
|
|
parent_resize();
|
1999-09-21 19:34:13 -07:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|