diff options
| author | Jason Rumney | 2008-06-20 15:28:26 +0000 |
|---|---|---|
| committer | Jason Rumney | 2008-06-20 15:28:26 +0000 |
| commit | 4c100a015c3ec0d8e15c82bb66730c93f7205eb4 (patch) | |
| tree | 9952f602b94854ed0454d0318b7c138f99426f3b /src | |
| parent | ca4a525076aaf7d0c65fddaefb0f0fd89b3db858 (diff) | |
| download | emacs-4c100a015c3ec0d8e15c82bb66730c93f7205eb4.tar.gz emacs-4c100a015c3ec0d8e15c82bb66730c93f7205eb4.zip | |
(font_matches_spec): Use csb bitfield from font signature to determine
language support.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/w32font.c | 23 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2133a063cef..7517f0e403b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-06-20 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32font.c (font_matches_spec): Use csb bitfield from font signature | ||
| 4 | to determine language support. | ||
| 5 | |||
| 1 | 2008-06-20 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2008-06-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * sysdep.c (cfsetspeed): New fun extracted from the code. | 8 | * sysdep.c (cfsetspeed): New fun extracted from the code. |
diff --git a/src/w32font.c b/src/w32font.c index 0dc18674aa0..f7b40595054 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -1103,6 +1103,11 @@ logfonts_match (font, pattern) | |||
| 1103 | return 1; | 1103 | return 1; |
| 1104 | } | 1104 | } |
| 1105 | 1105 | ||
| 1106 | /* Codepage Bitfields in FONTSIGNATURE struct. */ | ||
| 1107 | #define CSB_JAPANESE (1 << 17) | ||
| 1108 | #define CSB_KOREAN ((1 << 19) | (1 << 21)) | ||
| 1109 | #define CSB_CHINESE ((1 << 18) | (1 << 20)) | ||
| 1110 | |||
| 1106 | static int | 1111 | static int |
| 1107 | font_matches_spec (type, font, spec, backend, logfont) | 1112 | font_matches_spec (type, font, spec, backend, logfont) |
| 1108 | DWORD type; | 1113 | DWORD type; |
| @@ -1247,30 +1252,32 @@ font_matches_spec (type, font, spec, backend, logfont) | |||
| 1247 | } | 1252 | } |
| 1248 | else if (EQ (key, QClang) && SYMBOLP (val)) | 1253 | else if (EQ (key, QClang) && SYMBOLP (val)) |
| 1249 | { | 1254 | { |
| 1250 | /* Just handle the CJK languages here, as the language | 1255 | /* Just handle the CJK languages here, as the lang |
| 1251 | parameter is used to select a font with appropriate | 1256 | parameter is used to select a font with appropriate |
| 1252 | glyphs in the cjk unified ideographs block. Other fonts | 1257 | glyphs in the cjk unified ideographs block. Other fonts |
| 1253 | support for a language can be solely determined by | 1258 | support for a language can be solely determined by |
| 1254 | its character coverage. */ | 1259 | its character coverage. */ |
| 1255 | if (EQ (val, Qja)) | 1260 | if (EQ (val, Qja)) |
| 1256 | { | 1261 | { |
| 1257 | if (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) | 1262 | if (!(font->ntmFontSig.fsCsb[0] & CSB_JAPANESE)) |
| 1258 | return 0; | 1263 | return 0; |
| 1259 | } | 1264 | } |
| 1260 | else if (EQ (val, Qko)) | 1265 | else if (EQ (val, Qko)) |
| 1261 | { | 1266 | { |
| 1262 | if (font->ntmTm.tmCharSet != HANGUL_CHARSET | 1267 | if (!(font->ntmFontSig.fsCsb[0] & CSB_KOREAN)) |
| 1263 | && font->ntmTm.tmCharSet != JOHAB_CHARSET) | ||
| 1264 | return 0; | 1268 | return 0; |
| 1265 | } | 1269 | } |
| 1266 | else if (EQ (val, Qzh)) | 1270 | else if (EQ (val, Qzh)) |
| 1267 | { | 1271 | { |
| 1268 | if (font->ntmTm.tmCharSet != GB2312_CHARSET | 1272 | if (!(font->ntmFontSig.fsCsb[0] & CSB_CHINESE)) |
| 1269 | && font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET) | 1273 | return 0; |
| 1270 | return 0; | ||
| 1271 | } | 1274 | } |
| 1272 | else | 1275 | else |
| 1273 | /* Any other language, we don't recognize it. Fontset | 1276 | /* Any other language, we don't recognize it. Only the above |
| 1277 | currently appear in fontset.el, so it isn't worth | ||
| 1278 | creating a mapping table of codepages/scripts to languages | ||
| 1279 | or opening the font to see if there are any language tags | ||
| 1280 | in it that the W32 API does not expose. Fontset | ||
| 1274 | spec should have a fallback, as some backends do | 1281 | spec should have a fallback, as some backends do |
| 1275 | not recognize language at all. */ | 1282 | not recognize language at all. */ |
| 1276 | return 0; | 1283 | return 0; |