[uim-commit] r893 - trunk/xim
ekato at freedesktop.org
ekato at freedesktop.org
Sat Jun 18 13:53:05 PDT 2005
Author: ekato
Date: 2005-06-18 13:53:02 -0700 (Sat, 18 Jun 2005)
New Revision: 893
Modified:
trunk/xim/convdisp.cpp
trunk/xim/convdisp.h
Log:
* xim/convdisp.h (class Convdisp) : Add new public member
get_locale_name();
* xim/convdisp.cpp (gXftFontLocale) : New variable.
(init_default_xftfont) : Store a locale infomation for gXftFont.
(update_default_xftfont) : Ditto.
(class PeWin) : Remove redundant mXftFontName member.
(PeWin::PeWin) : Set gXftFont according to working locale.
(PeWin::set_xftfont) : Change mXftFont with considering locale.
(Convdisp::get_locale_name) : New function.
Modified: trunk/xim/convdisp.cpp
===================================================================
--- trunk/xim/convdisp.cpp 2005-06-18 18:52:07 UTC (rev 892)
+++ trunk/xim/convdisp.cpp 2005-06-18 20:53:02 UTC (rev 893)
@@ -76,6 +76,7 @@
#if HAVE_XFT_UTF8_STRING
XftFont *gXftFont;
char *gXftFontName;
+char *gXftFontLocale;
void
init_default_xftfont() {
@@ -86,6 +87,7 @@
XFT_FAMILY, XftTypeString, fontname,
XFT_PIXEL_SIZE, XftTypeDouble, (double)DEFAULT_FONT_SIZE,
NULL);
+ gXftFontLocale = strdup(setlocale(LC_CTYPE, NULL));
// maybe not needed, but in case it return NULL...
if (!gXftFont) {
gXftFont = XftFontOpen(XimServer::gDpy, DefaultScreen(XimServer::gDpy),
@@ -125,8 +127,10 @@
if (xftfont) {
XftFontClose(XimServer::gDpy, gXftFont);
free(gXftFontName);
+ free(gXftFontLocale);
gXftFont = xftfont;
gXftFontName = fontname;
+ gXftFontLocale = strdup(setlocale(LC_CTYPE, NULL));
}
}
}
@@ -207,7 +211,6 @@
#if HAVE_XFT_UTF8_STRING
XftFont *mXftFont;
int mXftFontSize;
- char *mXftFontName;
#endif
protected:
#if HAVE_XFT_UTF8_STRING
@@ -378,8 +381,15 @@
if (mConvdisp->use_xft() == true) {
#if HAVE_XFT_UTF8_STRING
mXftFontSize = DEFAULT_FONT_SIZE;
- mXftFont = gXftFont;
- mXftFontName = gXftFontName;
+ if (!strcmp(gXftFontLocale, locale)) {
+ mXftFont = gXftFont;
+ } else {
+ mXftFont = XftFontOpen(XimServer::gDpy,
+ DefaultScreen(XimServer::gDpy),
+ XFT_FAMILY, XftTypeString, gXftFontName,
+ XFT_PIXEL_SIZE, XftTypeDouble, (double)mXftFontSize,
+ NULL);
+ }
mXftDraw = XftDrawCreate(XimServer::gDpy, mPixmap,
DefaultVisual(XimServer::gDpy, scr_num),
DefaultColormap(XimServer::gDpy, scr_num));
@@ -537,7 +547,8 @@
void PeWin::set_xftfont(const char *xfld)
{
int size = get_fontsize(xfld);
- if (size != -1 && (mXftFontSize != size || strcmp(mXftFontName, gXftFontName))) {
+ const char *locale = mConvdisp->get_locale_name();
+ if (size != -1 && (mXftFontSize != size || strcmp(locale, gXftFontLocale))) {
if (mXftFont != gXftFont)
XftFontClose(XimServer::gDpy, mXftFont);
@@ -547,7 +558,6 @@
XFT_PIXEL_SIZE, XftTypeDouble, (double)size,
NULL);
mXftFontSize = size;
- mXftFontName = gXftFontName;
}
}
@@ -789,6 +799,11 @@
mLocaleName = locale;
}
+const char *Convdisp::get_locale_name()
+{
+ return mLocaleName;
+}
+
void Convdisp::set_pe(pe_stat *p)
{
m_pe = p;
Modified: trunk/xim/convdisp.h
===================================================================
--- trunk/xim/convdisp.h 2005-06-18 18:52:07 UTC (rev 892)
+++ trunk/xim/convdisp.h 2005-06-18 20:53:02 UTC (rev 893)
@@ -53,6 +53,7 @@
virtual void move_candwin() = 0;
virtual void set_im_lang(const char *im_lang);
virtual void set_locale_name(const char *locale);
+ virtual const char *get_locale_name();
virtual InputContext *get_context();
virtual bool use_xft() = 0;
More information about the uim-commit
mailing list