1999-09-21 19:34:13 -07:00
|
|
|
/* font.h -- Eterm font module header file
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2000-01-05 09:34:32 -08:00
|
|
|
* Copyright (C) 1997-2000, 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _FONT_H_
|
|
|
|
#define _FONT_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <X11/Xfuncproto.h>
|
|
|
|
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
|
|
|
|
|
|
|
|
/************ Macros and Definitions ************/
|
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
|
|
|
#define FONT_TYPE_X (0x01)
|
|
|
|
#define FONT_TYPE_TTF (0x02)
|
|
|
|
#define FONT_TYPE_FNLIB (0x03)
|
1999-09-21 19:34:13 -07:00
|
|
|
|
|
|
|
#define font_cache_add_ref(font) ((font)->ref_cnt++)
|
|
|
|
|
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
|
|
|
#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)
|
1999-09-21 19:34:13 -07:00
|
|
|
|
|
|
|
/************ Structures ************/
|
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
|
|
|
typedef struct cachefont_struct {
|
1999-09-21 19:34:13 -07:00
|
|
|
char *name;
|
|
|
|
unsigned char type;
|
|
|
|
unsigned char ref_cnt;
|
|
|
|
union {
|
|
|
|
XFontStruct *xfontinfo;
|
|
|
|
} fontinfo;
|
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
|
|
|
struct cachefont_struct *next;
|
|
|
|
} cachefont_t;
|
|
|
|
|
1999-09-21 19:34:13 -07:00
|
|
|
/************ Variables ************/
|
1999-12-20 11:08:00 -08:00
|
|
|
extern unsigned char font_idx, def_font_idx, font_cnt, font_chg;
|
1999-09-21 19:34:13 -07:00
|
|
|
extern const char *def_fontName[];
|
1999-09-28 12:38:43 -07:00
|
|
|
extern char *rs_font[NFONTS];
|
1999-12-02 18:31:33 -08:00
|
|
|
extern char **etfonts, **etmfonts;
|
1999-09-21 19:34:13 -07:00
|
|
|
# ifdef MULTI_CHARSET
|
|
|
|
extern const char *def_mfontName[];
|
1999-09-28 12:38:43 -07:00
|
|
|
extern char *rs_mfont[NFONTS];
|
1999-09-21 19:34:13 -07:00
|
|
|
# endif
|
|
|
|
|
|
|
|
/************ Function Prototypes ************/
|
|
|
|
_XFUNCPROTOBEGIN
|
|
|
|
|
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
|
|
|
extern void eterm_font_add(char ***plist, const char *fontname, unsigned char idx);
|
|
|
|
extern void eterm_font_delete(char **flist, unsigned char idx);
|
1999-09-21 19:34:13 -07:00
|
|
|
extern void *load_font(const char *, const char *, unsigned char);
|
|
|
|
extern void free_font(const void *);
|
|
|
|
extern void change_font(int, const char *);
|
|
|
|
|
|
|
|
_XFUNCPROTOEND
|
|
|
|
|
|
|
|
#endif /* _FONT_H_ */
|