diff --git a/ChangeLog b/ChangeLog index bc5001d..5e36047 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ namsh - Sung-Hyun Nam gbritton - Gerald Britton yosh - Manish Singh sdh - Scott D. Heavner +tzz - Ted Zlatanov ---------------------------------------------------------------------- Thu Sep 3 17:27:35 CDT 1998 Michael Jennings (mej) @@ -4504,3 +4505,16 @@ Tue Feb 12 00:27:03 2002 Michael Jennings (mej) Ahem. That was dumb. Let's just undo that, shall we? ---------------------------------------------------------------------- +Thu Feb 21 03:33:33 2002 Ted Zlatanov (tzz) + +Added crude performance tests. +---------------------------------------------------------------------- +Thu Feb 21 09:33:00 2002 Ted Zlatanov (tzz) + +Applied patch from Tomohiro KUBOTA to use auto +locale encodings. This is not too useful right now, but with the next +Eterm release it will be. I couldn't test thoroughly since I don't +have multiple locales on my system, but what I did test looked fine. + +I also fixed a CONFIG_BUFF constant missing from options.h +---------------------------------------------------------------------- diff --git a/acconfig.h b/acconfig.h index 4512f12..9104d33 100644 --- a/acconfig.h +++ b/acconfig.h @@ -305,6 +305,7 @@ #undef X_LOCALE #undef NO_XLOCALE #undef UTMP_SUPPORT +#undef AUTO_ENCODING #undef MULTI_CHARSET #undef USE_XIM #undef USE_X11R6_XIM diff --git a/configure.ac b/configure.ac index 60292c3..7529f98 100644 --- a/configure.ac +++ b/configure.ac @@ -181,7 +181,7 @@ AC_TYPE_SIGNAL AC_CHECK_FUNCS(atexit _exit unsetenv setutent \ seteuid memmove putenv strsep setresuid setresgid \ memmem usleep snprintf strcasestr strcasechr \ -strcasepbrk strrev) +strcasepbrk strrev nl_langinfo) dps_snprintf_oflow() AC_CHECK_LIB(m, pow) @@ -594,6 +594,18 @@ AC_ARG_WITH(mousewheel, AC_DEFINE(MOUSEWHEEL) ]) +AC_MSG_CHECKING(for automatic encoding) +AC_ARG_ENABLE(auto-encoding, +[ --enable-auto-encoding compile with runtime automatic encoding setting], + if test "$enableval" = "no"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + AC_DEFINE(AUTO_ENCODING) + fi, AC_MSG_RESULT(yes) + AC_DEFINE(AUTO_ENCODING) +) + MULTICHAR_ENCODING="" AC_MSG_CHECKING(for multi-charset support) AC_ARG_ENABLE(multi-charset, diff --git a/configure.in b/configure.in index 65a03c1..8bc998a 100644 --- a/configure.in +++ b/configure.in @@ -181,7 +181,7 @@ AC_TYPE_SIGNAL AC_CHECK_FUNCS(atexit _exit unsetenv setutent \ seteuid memmove putenv strsep setresuid setresgid \ memmem usleep snprintf strcasestr strcasechr \ -strcasepbrk strrev) +strcasepbrk strrev nl_langinfo) dps_snprintf_oflow() AC_CHECK_LIB(m, pow) @@ -594,6 +594,18 @@ AC_ARG_WITH(mousewheel, AC_DEFINE(MOUSEWHEEL) ]) +AC_MSG_CHECKING(for automatic encoding) +AC_ARG_ENABLE(auto-encoding, +[ --enable-auto-encoding compile with runtime automatic encoding setting], + if test "$enableval" = "no"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + AC_DEFINE(AUTO_ENCODING) + fi, AC_MSG_RESULT(yes) + AC_DEFINE(AUTO_ENCODING) +) + MULTICHAR_ENCODING="" AC_MSG_CHECKING(for multi-charset support) AC_ARG_ENABLE(multi-charset, diff --git a/src/Makefile.am b/src/Makefile.am index eee2b46..2e10687 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,7 +13,9 @@ libEterm_la_SOURCES = actions.c actions.h buttons.c buttons.h command.c options.c options.h pixmap.c pixmap.h profile.h screen.c \ screen.h script.c script.h scrollbar.c scrollbar.h \ startup.c startup.h system.c system.h term.c term.h \ - timer.c timer.h utmp.c windows.c windows.h + timer.c timer.h utmp.c windows.c windows.h defaultfont.c \ + defaultfont.h + EXTRA_libEterm_la_SOURCES = $(MMX_SRCS) libEterm_la_LDFLAGS = -release $(VERSION) diff --git a/src/command.c b/src/command.c index 1d5a338..4376669 100644 --- a/src/command.c +++ b/src/command.c @@ -1724,7 +1724,7 @@ create_fontset(const char *font1, const char *font2) XFontSet fontset = 0; char *fontname, **ml, *ds; int mc; - const char fs_base[] = ",-misc-fixed-*-r-*-*-*-120-*-*-*-*-*-*"; + const char fs_base[] = ",-misc-fixed-*-r-*-*-*-120-*-*-*-*-*-*,*"; ASSERT(font1 != NULL); diff --git a/src/defaultfont.c b/src/defaultfont.c new file mode 100644 index 0000000..63d8942 --- /dev/null +++ b/src/defaultfont.c @@ -0,0 +1,289 @@ +/* + * Setting default font and encoding according to user's locale (LC_CTYPE). + */ + +#include "config.h" +#include "feature.h" + +#include "font.h" +#include "defaultfont.h" + +#define ENCODINGBUFLEN 100 + +#ifdef AUTO_ENCODING + +/* + * Table to convert from encoding names to enc_label. + * This table is useful to normalize encoding names + * and support various return value from nl_langinfo(3). + * + * The encoding names here are "truncated" names, + * where all alphabets are uppercase and all '-' and + * '_' are eliminated. + */ +const struct name2encoding n2e[] = { +#ifdef MULTI_CHARSET + { "EUCJP", ENC_EUCJ }, + { "UJIS", ENC_EUCJ }, + { "SHIFTJIS", ENC_SJIS }, + { "SJIS", ENC_SJIS }, + { "EUCKR", ENC_EUCKR }, + { "EUCCN", ENC_GB }, + { "GB2312", ENC_GB }, + { "GB", ENC_GB }, + { "BIG5", ENC_BIG5 }, + { "BIGFIVE", ENC_BIG5 }, + { "BIG5HKSCS", ENC_BIG5 }, + { "UTF8", ENC_UTF8 }, +#endif /* MULTI_CHARSET */ + { "KOI8R", ENC_KOI8R }, + { "KOI8U", ENC_KOI8U }, + { "ISO88591", ENC_ISO8859_1 }, + { "ISO88592", ENC_ISO8859_2 }, + { "ISO88593", ENC_ISO8859_3 }, + { "ISO88594", ENC_ISO8859_4 }, + { "ISO88595", ENC_ISO8859_5 }, + { "ISO88596", ENC_ISO8859_6 }, + { "ISO88597", ENC_ISO8859_7 }, + { "ISO88598", ENC_ISO8859_8 }, + { "ISO88599", ENC_ISO8859_9 }, + { "ISO885910", ENC_ISO8859_10 }, + { "ISO885911", ENC_ISO8859_11 }, + { "ISO885912", ENC_ISO8859_12 }, + { "ISO885913", ENC_ISO8859_13 }, + { "ISO885914", ENC_ISO8859_14 }, + { "ISO885915", ENC_ISO8859_15 }, + { NULL, ENC_DUMMY } +}; + + +/* + * This table converts from locale names to enc_label. + * + * This table is used to know which encoding is used + * as the default in the current user environment + * (LC_CTYPE locale), since it is the standard way + * for users to specify encoding by LANG/LC_CTYPE/LC_ALL + * variables (i.e., LC_CTYPE locale). Consult locale(7). + * + * This table is used when nl_langinfo(3) is not available + * or it fails. + * + * locale names whose "encoding" part are listed in n2e[] + * can be omitted here, because "encoding" part is checked + * separately before l2e[] check. + * + * Note that longer locale names must be written earlier + * than shorter locale names in this table, because + * strncmp(3) is used for seek for this table. + */ +const struct name2encoding l2e[] = { +#ifdef MULTI_CHARSET + { "ja_JP.EUC", ENC_EUCJ }, + { "ja_JP", ENC_EUCJ }, + { "ko_KR.EUC", ENC_EUCKR }, + { "ko_KR", ENC_EUCKR }, + { "zh_CN.EUC", ENC_GB }, + { "zh_CN", ENC_GB }, + { "zh_TW", ENC_BIG5 }, +#endif /* MULTI_CHARSET */ + { "da", ENC_ISO8859_1 }, + { "de", ENC_ISO8859_1 }, + { "en", ENC_ISO8859_1 }, + { "fi", ENC_ISO8859_1 }, + { "fr", ENC_ISO8859_1 }, + { "is", ENC_ISO8859_1 }, + { "it", ENC_ISO8859_1 }, + { "la", ENC_ISO8859_1 }, + { "lt", ENC_ISO8859_1 }, + { "nl", ENC_ISO8859_1 }, + { "no", ENC_ISO8859_1 }, + { "pt", ENC_ISO8859_1 }, + { "sv", ENC_ISO8859_1 }, + { "cs", ENC_ISO8859_2 }, + { "hr", ENC_ISO8859_2 }, + { "hu", ENC_ISO8859_2 }, + { "la", ENC_ISO8859_2 }, + { "lt", ENC_ISO8859_2 }, + { "pl", ENC_ISO8859_2 }, + { "ro", ENC_ISO8859_2 }, + { "sk", ENC_ISO8859_2 }, + { "sl", ENC_ISO8859_2 }, + { "ar", ENC_ISO8859_6 }, + { "el", ENC_ISO8859_7 }, + { "tr", ENC_ISO8859_9 }, + { "lt", ENC_ISO8859_13 }, + { "lv", ENC_ISO8859_13 }, + { "mi", ENC_ISO8859_13 }, + { "ru", ENC_KOI8R }, /* ISO8859-5 ? */ + { "uk", ENC_KOI8U }, +#if 0 + { "vi", ENC_VISCII }, + { "th", ENC_TIS620 }, +#endif + { NULL, ENC_DUMMY } +}; + + +/* + * Default font name for each language. + * I'd like these names edited by native speakers. + * + * enc_label --> ENCODING_METHOD and font informations + * which as needed for Rxvt to work. + */ +const struct defaultfont defaultfont[] = { +#ifdef MULTI_CHARSET + { ENC_EUCJ, "eucj", DEF_EUCJ, {NFONT_LIST_EUCJ}, {MFONT_LIST_EUCJ} }, + { ENC_SJIS, "sjis", DEF_EUCJ, {NFONT_LIST_EUCJ}, {MFONT_LIST_EUCJ} }, + { ENC_GB, "gb", DEF_GB, {NFONT_LIST_GB}, {MFONT_LIST_GB} }, + { ENC_BIG5, "big5", DEF_BIG5, {NFONT_LIST_BIG5}, {MFONT_LIST_BIG5} }, + { ENC_EUCKR, "euckr",DEF_EUCKR, {NFONT_LIST_EUCKR}, {MFONT_LIST_EUCKR} }, + { ENC_UTF8, "iso-10646",DEF_10646,{NFONT_LIST_10646},{MFONT_LIST_10646} }, +#endif /* MULTI_CHARSET */ + { ENC_ISO8859_7,"noenc",DEF_7, {NFONT_LIST_7}, {MFONT_LIST_NULL} }, + { ENC_KOI8R, "noenc",DEF_KOI8R, {NFONT_LIST_KOI8R}, {MFONT_LIST_NULL} }, + { ENC_KOI8U, "noenc",DEF_KOI8U, {NFONT_LIST_KOI8U}, {MFONT_LIST_NULL} }, + { ENC_DUMMY, "noenc",DEF_DUMMY, {MFONT_LIST_NULL}, {MFONT_LIST_NULL} } +}; + +/* special common rule for ISO-8859-x */ +const char *const defaultfont_8859[] = { + NFONT_LIST_ISO8859X +}; + +/* fallback defaults */ +const int def_def_idx = DEF_10646; + +const char *const def_fonts[] = { + NFONT_LIST_10646 +}; + +#ifdef MULTI_CHARSET +const char *const def_mfonts[] = { + MFONT_LIST_10646 +}; +#endif + +/*----------------------------------------------------------------------*/ +/* EXTPROTO */ +void +eterm_default_font_locale(char ***fonts, char ***mfonts, char **mencoding, int *def_idx) +{ + char *locale; + char *encoding_str = NULL; + char encoding_buf[ENCODINGBUFLEN]; + char *p, *p2; + enum enc_label encoding = ENC_DUMMY; + int j, k; + + locale = setlocale(LC_CTYPE, ""); + if (locale == NULL) + if ((locale = getenv("LC_ALL")) == NULL) + if ((locale = getenv("LC_CTYPE")) == NULL) + if ((locale = getenv("LANG")) == NULL) + locale = "C"; /* failsafe */ + + /* Obtain a "normalized" name of current encoding. + * The current encoding is available via nl_langinfo(). + * Otherwise, it comes from locale name. + */ +#ifdef HAVE_NL_LANGINFO + encoding_str = nl_langinfo(CODESET); +#else + encoding_str = NULL; +#endif + if (encoding_str && *encoding_str) { + for (j = 0; n2e[j].name; j++) { + if (!strcmp(encoding_str, n2e[j].name)) { + encoding = n2e[j].encoding; + break; + } + } + } + + if (encoding == ENC_DUMMY) { + p = strchr(locale, '.'); + if (p) { + strncpy(encoding_buf, p + 1, ENCODINGBUFLEN); + p = strchr(encoding_buf, '@'); + if (p) *p = 0; + } else { + strncpy(encoding_buf, locale, ENCODINGBUFLEN); + } + encoding_buf[ENCODINGBUFLEN - 1] = 0; + for (p = p2 = encoding_buf; 1; p++, p2++) { + while (*p2 == '_' || *p2 == '-') p2++; + if (!*p2) break; + *p = toupper(*p2); + } + *p = 0; + for (j = 0; n2e[j].name; j++) { + if (!strcmp(encoding_buf, n2e[j].name)) { + encoding = n2e[j].encoding; + break; + } + } + } + + /* If the conversion fails, try using "language"/"country" + * part of the locale name. + */ + if (encoding == ENC_DUMMY) { + for (j = 0; l2e[j].name; j++) { + if (!strncmp(locale, l2e[j].name, strlen(l2e[j].name))) { + encoding = l2e[j].encoding; + break; + } + } + } + + /* Now, the encoding to be used has been determined. + * Fonts and encoding will be determined according to the encoding. + */ + for (j = 0; defaultfont[j].enc_label != ENC_DUMMY; j++) { + if (encoding == defaultfont[j].enc_label) { + *def_idx = defaultfont[j].def_idx; +#ifdef MULTI_CHARSET + *mencoding = STRDUP(defaultfont[j].encoding_method); +#endif + for (k = 0; k < NFONTS; k++) { + eterm_font_add(fonts, defaultfont[j].font[k], k); +#ifdef MULTI_CHARSET + eterm_font_add(mfonts, defaultfont[j].mfont[k], k); +#endif + } + return; + } + } + +/* + * fallback for unknown encodings. ISO-8559-* gets special treatment + */ + +#ifdef MULTI_CHARSET + *mencoding = STRDUP("noenc"); +#endif + if (encoding >= ENC_ISO8859_1 && encoding <= ENC_ISO8859_LAST) { + /* fallback for ISO-8859-* encodings */ + k = encoding - ENC_ISO8859_1 + 1; + *def_idx = DEF_8859; + } else { + /* fallback for "C", "POSIX", and invalid locales */ + k = 0; + *def_idx = def_def_idx; + } + + for (j = 0; j < NFONTS; j++) { + if (k == 0) eterm_font_add(fonts, def_fonts[j], j); + else { + /* couple of wasted bytes each but lots of future expansion */ + sprintf(encoding_buf, defaultfont_8859[j], k); + eterm_font_add(fonts, encoding_buf, j); + } +#ifdef MULTI_CHARSET + eterm_font_add(mfonts, def_mfonts[j], j); +#endif + } +} +#endif /* AUTO_ENCODING */ diff --git a/src/defaultfont.h b/src/defaultfont.h new file mode 100644 index 0000000..873850b --- /dev/null +++ b/src/defaultfont.h @@ -0,0 +1,172 @@ +#ifndef _DEFAULTFONT_H_ +#define _DEFAULTFONT_H_ + +#if defined (NO_XLOCALE) || !defined(HAVE_X11_LOCALE_H) +# include +#else +# include +#endif + +#ifdef HAVE_NL_LANGINFO +# include +#endif + + +extern void eterm_default_font_locale(char ***fonts, char ***mfonts, char **mencoding, int *def_idx); + +/* + * List of encoding labels. + * Note "encoding" is not "character set" nor "encoding method". + * + * In Rxvt, "encoding" is implemented as a pair of "encoding method" + * (implemented as ENC_METHOD in screen.h) and font specification, + * i.e., defaultfont[] in this file. + * + * This type is used only in this file. + */ + +enum enc_label { + ENC_SJIS, ENC_EUCJ, ENC_GB, ENC_BIG5, ENC_EUCKR, + ENC_ISO8859_1, ENC_ISO8859_2, ENC_ISO8859_3, ENC_ISO8859_4, + ENC_ISO8859_5, ENC_ISO8859_6, ENC_ISO8859_7, ENC_ISO8859_8, + ENC_ISO8859_9, ENC_ISO8859_10, ENC_ISO8859_11, ENC_ISO8859_12, + ENC_ISO8859_13, ENC_ISO8859_14, ENC_ISO8859_15, + ENC_KOI8R, ENC_KOI8U, ENC_UTF8, + /* ENC_VISCII, ENC_VSCII, ENC_TIS620, ENC_UTF8, */ + ENC_DUMMY +}; + +#define ENC_ISO8859_LAST ENC_ISO8859_15 + + +/* + * Used for tables of locale/encoding names -> encodng labels. + */ + +struct name2encoding { + const char *name; + const enum enc_label encoding; +}; + +/* + * Used for tables of encoding labels -> Rxvt internal informations. + * + */ + +struct defaultfont { + const enum enc_label enc_label; + const char *encoding_method; + const int def_idx; + const char *font[NFONTS]; + const char *mfont[NFONTS]; +}; + + +/* + ***************************************************************************** + * FONT DEFINITIONS + ***************************************************************************** + */ + +/* + * FONTS TO BE USED + * + * ---------------------------------------------------------------------- + * font name font package name available from + * ---------------------------------------------------------------------- + * k12 shinonome + * http://www.on.cs.keio.ac.jp/~yasu/jp_fonts.html + * k18 intlfonts ftp.gnu.org/pub/gnu + * -*-ming-medium-r-normal-*-big5-0 + * cmexfonts + * http://metalab.unc.edu/pub/Linux/X11/fonts/ + * -*-gulim-medium-r-normal-*-ksc5601.1987-0 + * baekmuk ftp.mizi.co.kr/pub/baekmuk/ + * -misc-grfixed-medium-r-*-iso8859-7 + * hrnet&hcr + * http://www.hellug.gr/gr/howto/howto/pub/html/Hellenic-HOWTO.html + * -cronyx-fixed-medium-r-*-koi8-u + * Xcyr http://sawsoft.newmail.ru/LS/ + * all others XFree86 http://www.xfree86.org/ + * ---------------------------------------------------------------------- + */ + +#define DEF_DUMMY DEF_10646 +#define NFONT_LIST_NULL NFONT_LIST_10646 +#define MFONT_LIST_NULL MFONT_LIST_10646 + +#define DEF_EUCJ 1 +#define NFONT_LIST_EUCJ "6x12","7x14", "8x16", "9x18", "12x24" +#define MFONT_LIST_EUCJ "k12", "k14", "kanji16", "k18", "kanji24" + +#define DEF_GB 0 +#define NFONT_LIST_GB "8x16", "12x24", "", "", "" +#define MFONT_LIST_GB \ + "-isas-song ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0", \ + "-isas-song ti-medium-r-normal--24-240-72-72-c-240-gb2312.1980-0", \ + "", "", "" + +#define DEF_BIG5 0 +#define NFONT_LIST_BIG5 "8x16", "9x18", "10x20", "12x24", "13x26" +#define MFONT_LIST_BIG5 \ + "-*-ming-medium-r-normal-*-16-*-*-*-c-*-big5-0",\ + "-*-ming-medium-r-normal-*-18-*-*-*-c-*-big5-0",\ + "-*-ming-medium-r-normal-*-20-*-*-*-c-*-big5-0",\ + "-*-ming-medium-r-normal-*-24-*-*-*-c-*-big5-0",\ + "-*-ming-medium-r-normal-*-26-*-*-*-c-*-big5-0" + +#define DEF_EUCKR 1 +#define NFONT_LIST_EUCKR "7x14", "8x16", "9x18", "10x20", "12x24" +#define MFONT_LIST_EUCKR \ + "-*-gulim-medium-r-normal--14-*-*-*-*-140-ksc5601.1987-0",\ + "-*-gulim-medium-r-normal--16-*-*-*-*-160-ksc5601.1987-0",\ + "-*-gulim-medium-r-normal--18-*-*-*-*-180-ksc5601.1987-0",\ + "-*-gulim-medium-r-normal--20-*-*-*-*-200-ksc5601.1987-0",\ + "-*-gulim-medium-r-normal--24-*-*-*-*-240-ksc5601.1987-0" + +#define DEF_7 1 +#define NFONT_LIST_7 \ + "-misc-grfixed-medium-r-semicondensed--10-100-75-75-c-60-iso8859-7",\ + "-misc-grfixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-7",\ + "-misc-grfixed-medium-r-normal--14-110-75-75-c-75-iso8859-7",\ + "-misc-grfixed-medium-r-normal--16-120-75-75-c-75-iso8859-7",\ + "-misc-grfixed-medium-r-normal--25-190-75-75-c-90-iso8859-7" + +#define DEF_KOI8R 1 +#define NFONT_LIST_KOI8R \ + "-cronyx-fixed-medium-r-normal--10-100-75-75-c-60-koi8-r",\ + "-cronyx-fixed-medium-r-semicondensed--13-120-75-75-c-60-koi8-r",\ + "-cronyx-fixed-medium-r-normal--13-120-75-75-c-80-koi8-r",\ + "-cronyx-fixed-medium-r-normal--15-140-75-75-c-90-koi8-r",\ + "-cronyx-fixed-medium-r-normal--20-200-75-75-c-100-koi8-r" + +#define DEF_KOI8U 1 +#define NFONT_LIST_KOI8U \ + "-cronyx-fixed-medium-r-normal--10-100-75-75-c-60-koi8-u",\ + "-cronyx-fixed-medium-r-semicondensed--13-120-75-75-c-60-koi8-u",\ + "-cronyx-fixed-medium-r-normal--13-120-75-75-c-80-koi8-u",\ + "-cronyx-fixed-medium-r-normal--14-130-75-75-c-70-koi8-u",\ + "-cronyx-fixed-medium-r-normal--15-140-75-75-c-90-koi8-u" + +#define DEF_10646 2 +#define NFONT_LIST_10646 "5x7", "6x10", "fixed", "8x13", "9x15" +#define MFONT_LIST_10646 \ + "-misc-fixed-medium-r-normal--7-70-75-75-c-50-iso10646-1",\ + "-misc-fixed-medium-r-normal--10-100-75-75-c-60-iso10646-1",\ + "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1",\ + "-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1",\ + "-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1" + +/* special common rule for ISO-8859-* */ + +#define DEF_8859 2 +#define NFONT_LIST_ISO8859X \ + "-misc-fixed-medium-r-normal--7-70-75-75-c-50-iso8859-%d",\ + "-misc-fixed-medium-r-normal--10-100-75-75-c-60-iso8859-%d",\ + "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-%d",\ + "-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-%d",\ + "-misc-fixed-medium-r-normal--18-120-75-75-c-90-iso8859-%d" + + +#endif /* _DEFAULTFONT_H_ */ + diff --git a/src/options.c b/src/options.c index 72369e4..02977c5 100644 --- a/src/options.c +++ b/src/options.c @@ -54,6 +54,7 @@ static const char cvs_ident[] = "$Id$"; #include "system.h" #include "term.h" #include "windows.h" +#include "defaultfont.h" static void *parse_color(char *, void *); static void *parse_attributes(char *, void *); @@ -2751,6 +2752,13 @@ init_defaults(void) colorfgbg = DEFAULT_RSTYLE; #endif MEMSET(rs_font, 0, sizeof(char *) * NFONTS); +#if AUTO_ENCODING +#ifdef MULTI_CHARSET + eterm_default_font_locale(&etfonts, &etmfonts, &rs_multichar_encoding, &def_font_idx); +#else + eterm_default_font_locale(&etfonts, NULL, NULL, &def_font_idx); +#endif +#else for (i = 0; i < NFONTS; i++) { eterm_font_add(&etfonts, def_fontName[i], i); #ifdef MULTI_CHARSET @@ -2759,6 +2767,7 @@ init_defaults(void) } #ifdef MULTI_CHARSET rs_multichar_encoding = STRDUP(MULTICHAR_ENCODING); +#endif #endif TermWin.internalBorder = DEFAULT_BORDER_WIDTH; diff --git a/src/options.h b/src/options.h index 3bdcecc..b45f1a1 100644 --- a/src/options.h +++ b/src/options.h @@ -156,6 +156,9 @@ extern KeySym ks_bigfont; extern KeySym ks_smallfont; #endif +/* used in options.c but not declared in options.h or anywhere else - fixed until mej gets to it */ +#define CONFIG_BUFF 4096 + /************ Function Prototypes ************/ _XFUNCPROTOBEGIN diff --git a/themes/Eterm/theme.cfg.in b/themes/Eterm/theme.cfg.in index f15521e..157b64a 100644 --- a/themes/Eterm/theme.cfg.in +++ b/themes/Eterm/theme.cfg.in @@ -69,33 +69,8 @@ begin attributes # name %appname() # iconname Eterm -# Set the fonts. These must be monospace fonts. The values shown are -# 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 default @DEF_FONT_IDX@ - font 0 @FONT0@ - font 1 @FONT1@ - font 2 @FONT2@ - font 3 @FONT3@ - font 4 @FONT4@ - font 5 10x20 - font 6 12x24 -# font bold 7x14 end attributes -# The Multichar support options. Same goes for these fonts as for the normal -# ones. The "encoding" attribute can be either "eucj" or "sjis" or "euckr" -# or big5 or gb -begin multichar - font 0 @MFONT0@ - font 1 @MFONT1@ - font 2 @MFONT2@ - font 3 @MFONT3@ - font 4 @MFONT4@ - encoding @MULTICHAR_ENCODING@ -end multichar - # Define the imageclasses. begin imageclasses diff --git a/themes/auto/theme.cfg.in b/themes/auto/theme.cfg.in index c0c9836..3f515ea 100644 --- a/themes/auto/theme.cfg.in +++ b/themes/auto/theme.cfg.in @@ -26,24 +26,6 @@ begin color color bd #ffffff color ul #ffffff end color -begin attributes - font default @DEF_FONT_IDX@ - font 0 @FONT0@ - font 1 @FONT1@ - font 2 @FONT2@ - font 3 @FONT3@ - font 4 @FONT4@ - font 5 10x20 - font 6 12x24 -end attributes -begin multichar - font 0 @MFONT0@ - font 1 @MFONT1@ - font 2 @MFONT2@ - font 3 @MFONT3@ - font 4 @MFONT4@ - encoding @MULTICHAR_ENCODING@ -end multichar begin imageclasses path "./pix/:~/.Eterm/:~/.Eterm/themes/Eterm/pix:~/.Eterm/pix/:@PKGDATADIR@/pix/" begin image diff --git a/themes/chooser/theme.cfg.in b/themes/chooser/theme.cfg.in index d468bc7..698de4a 100644 --- a/themes/chooser/theme.cfg.in +++ b/themes/chooser/theme.cfg.in @@ -28,23 +28,7 @@ begin color end color begin attributes name "%appname() -- Host Chooser" - font default @DEF_FONT_IDX@ - font 0 @FONT0@ - font 1 @FONT1@ - font 2 @FONT2@ - font 3 @FONT3@ - font 4 @FONT4@ - font 5 10x20 - font 6 12x24 end attributes -begin multichar - font 0 @MFONT0@ - font 1 @MFONT1@ - font 2 @MFONT2@ - font 3 @MFONT3@ - font 4 @MFONT4@ - encoding @MULTICHAR_ENCODING@ -end multichar begin imageclasses path "./pix/:~/.Eterm/:~/.Eterm/themes/Eterm/pix:~/.Eterm/pix/:@PKGDATADIR@/pix/" begin image diff --git a/themes/trans/theme.cfg.in b/themes/trans/theme.cfg.in index 11ab2ec..41decbf 100644 --- a/themes/trans/theme.cfg.in +++ b/themes/trans/theme.cfg.in @@ -29,23 +29,7 @@ end color begin attributes title "%appname() -- Pseudo-transparency Theme" name Eterm-transparent - font default @DEF_FONT_IDX@ - font 0 @FONT0@ - font 1 @FONT1@ - font 2 @FONT2@ - font 3 @FONT3@ - font 4 @FONT4@ - font 5 10x20 - font 6 12x24 end attributes -begin multichar - font 0 @MFONT0@ - font 1 @MFONT1@ - font 2 @MFONT2@ - font 3 @MFONT3@ - font 4 @MFONT4@ - encoding @MULTICHAR_ENCODING@ -end multichar begin imageclasses path "./pix/:~/.Eterm/:~/.Eterm/themes/Eterm/pix:~/.Eterm/pix/:@PKGDATADIR@/pix/" begin image