diff options
-rw-r--r-- | src/FbTk/XmbFontImp.cc | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc index 53d94fe..364491f 100644 --- a/src/FbTk/XmbFontImp.cc +++ b/src/FbTk/XmbFontImp.cc | |||
@@ -138,56 +138,14 @@ XFontSet createFontSet(const char *fontname, bool& utf8mode) { | |||
138 | 138 | ||
139 | #ifdef HAVE_SETLOCALE | 139 | #ifdef HAVE_SETLOCALE |
140 | if (! fs) { | 140 | if (! fs) { |
141 | if (nmissing) XFreeStringList(missing); | 141 | if (nmissing) |
142 | XFreeStringList(missing); | ||
142 | 143 | ||
143 | setlocale(LC_CTYPE, "C"); | 144 | setlocale(LC_CTYPE, "C"); |
144 | fs = XCreateFontSet(display, fontname, | 145 | fs = XCreateFontSet(display, fontname, |
145 | &missing, &nmissing, &def); | 146 | &missing, &nmissing, &def); |
146 | setlocale(LC_CTYPE, orig_locale.c_str()); | 147 | setlocale(LC_CTYPE, orig_locale.c_str()); |
147 | } | 148 | } |
148 | #endif // HAVE_SETLOCALE | ||
149 | |||
150 | if (fs) { | ||
151 | XFontStruct **fontstructs; | ||
152 | char **fontnames; | ||
153 | XFontsOfFontSet(fs, &fontstructs, &fontnames); | ||
154 | fontname = fontnames[0]; | ||
155 | } | ||
156 | |||
157 | getFontElement(fontname, weight, FONT_ELEMENT_SIZE, | ||
158 | "-medium-", "-bold-", "-demibold-", "-regular-", NULL); | ||
159 | getFontElement(fontname, slant, FONT_ELEMENT_SIZE, | ||
160 | "-r-", "-i-", "-o-", "-ri-", "-ro-", NULL); | ||
161 | getFontSize(fontname, &pixel_size); | ||
162 | |||
163 | if (! strcmp(weight, "*")) | ||
164 | strncpy(weight, "medium", FONT_ELEMENT_SIZE); | ||
165 | if (! strcmp(slant, "*")) | ||
166 | strncpy(slant, "r", FONT_ELEMENT_SIZE); | ||
167 | if (pixel_size < 3) | ||
168 | pixel_size = 3; | ||
169 | else if (pixel_size > 97) | ||
170 | pixel_size = 97; | ||
171 | |||
172 | buf_size = strlen(fontname) + (FONT_ELEMENT_SIZE * 2) + 64; | ||
173 | char *pattern2 = new char[buf_size]; | ||
174 | snprintf(pattern2, buf_size - 1, | ||
175 | "%s," | ||
176 | "-*-*-%s-%s-*-*-%d-*-*-*-*-*-*-*," | ||
177 | "-*-*-*-*-*-*-%d-*-*-*-*-*-*-*,*", | ||
178 | fontname, weight, slant, pixel_size, pixel_size); | ||
179 | fontname = pattern2; | ||
180 | |||
181 | if (nmissing) | ||
182 | XFreeStringList(missing); | ||
183 | if (fs) | ||
184 | XFreeFontSet(display, fs); | ||
185 | |||
186 | fs = XCreateFontSet(display, fontname, | ||
187 | &missing, &nmissing, &def); | ||
188 | delete [] pattern2; | ||
189 | |||
190 | #ifdef HAVE_SETLOCALE | ||
191 | if (utf8mode) | 149 | if (utf8mode) |
192 | setlocale(LC_CTYPE, orig_locale.c_str()); | 150 | setlocale(LC_CTYPE, orig_locale.c_str()); |
193 | #endif // HAVE_SETLOCALE | 151 | #endif // HAVE_SETLOCALE |