diff options
| author | Jason Rumney | 2008-06-11 22:40:06 +0000 |
|---|---|---|
| committer | Jason Rumney | 2008-06-11 22:40:06 +0000 |
| commit | f42adef67d57ce6765e4c2bf8bcde280c4af3500 (patch) | |
| tree | c07287fb8d6c9941af8e748134cbecb7dcae2777 /src | |
| parent | 0408f85857fda2e7607dcf8add106365f44471f4 (diff) | |
| download | emacs-f42adef67d57ce6765e4c2bf8bcde280c4af3500.tar.gz emacs-f42adef67d57ce6765e4c2bf8bcde280c4af3500.zip | |
(w32font_encode_char): Detect missing glyphs that are misreported as space.
(add_font_entity_to_list): Support unicode-bmp and unicode-sip
as aliases for registry iso10646-1.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/w32font.c | 15 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3caabe5792c..a25296ba529 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-06-11 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32font.c (w32font_encode_char): Detect missing glyphs that are | ||
| 4 | misreported as space. | ||
| 5 | (add_font_entity_to_list): Support unicode-bmp and unicode-sip | ||
| 6 | as aliases for registry iso10646-1. | ||
| 7 | |||
| 1 | 2008-06-11 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2008-06-11 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * buffer.c (clone_per_buffer_values): Skip `name'. | 10 | * buffer.c (clone_per_buffer_values): Skip `name'. |
diff --git a/src/w32font.c b/src/w32font.c index 94f330fe76e..8945ced8c95 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -310,6 +310,9 @@ w32font_encode_char (font, c) | |||
| 310 | dc = get_frame_dc (f); | 310 | dc = get_frame_dc (f); |
| 311 | old_font = SelectObject (dc, w32_font->compat_w32_font->hfont); | 311 | old_font = SelectObject (dc, w32_font->compat_w32_font->hfont); |
| 312 | 312 | ||
| 313 | /* GetCharacterPlacement is used here rather than GetGlyphIndices because | ||
| 314 | it is supported on Windows NT 4 and 9x/ME. But it cannot reliably report | ||
| 315 | missing glyphs, see below for workaround. */ | ||
| 313 | retval = GetCharacterPlacementW (dc, in, len, 0, &result, 0); | 316 | retval = GetCharacterPlacementW (dc, in, len, 0, &result, 0); |
| 314 | 317 | ||
| 315 | SelectObject (dc, old_font); | 318 | SelectObject (dc, old_font); |
| @@ -317,7 +320,11 @@ w32font_encode_char (font, c) | |||
| 317 | 320 | ||
| 318 | if (retval) | 321 | if (retval) |
| 319 | { | 322 | { |
| 320 | if (result.nGlyphs != 1 || !result.lpGlyphs[0]) | 323 | if (result.nGlyphs != 1 || !result.lpGlyphs[0] |
| 324 | /* GetCharacterPlacementW seems to return 3, which seems to be | ||
| 325 | the space glyph in most/all truetype fonts, instead of 0 | ||
| 326 | for unsupported glyphs. */ | ||
| 327 | || (result.lpGlyphs[0] == 3 && !iswspace (in[0]))) | ||
| 321 | return FONT_INVALID_CODE; | 328 | return FONT_INVALID_CODE; |
| 322 | return result.lpGlyphs[0]; | 329 | return result.lpGlyphs[0]; |
| 323 | } | 330 | } |
| @@ -1360,7 +1367,9 @@ add_font_entity_to_list (logical_font, physical_font, font_type, lParam) | |||
| 1360 | /* If registry was specified as iso10646-1, only report | 1367 | /* If registry was specified as iso10646-1, only report |
| 1361 | ANSI and DEFAULT charsets, as most unicode fonts will | 1368 | ANSI and DEFAULT charsets, as most unicode fonts will |
| 1362 | contain one of those plus others. */ | 1369 | contain one of those plus others. */ |
| 1363 | if (EQ (spec_charset, Qiso10646_1) | 1370 | if ((EQ (spec_charset, Qiso10646_1) |
| 1371 | || EQ (spec_charset, Qunicode_bmp) | ||
| 1372 | || EQ (spec_charset, Qunicode_sip)) | ||
| 1364 | && logical_font->elfLogFont.lfCharSet != DEFAULT_CHARSET | 1373 | && logical_font->elfLogFont.lfCharSet != DEFAULT_CHARSET |
| 1365 | && logical_font->elfLogFont.lfCharSet != ANSI_CHARSET) | 1374 | && logical_font->elfLogFont.lfCharSet != ANSI_CHARSET) |
| 1366 | return 1; | 1375 | return 1; |
| @@ -1370,6 +1379,8 @@ add_font_entity_to_list (logical_font, physical_font, font_type, lParam) | |||
| 1370 | least it eliminates known definite mismatches. */ | 1379 | least it eliminates known definite mismatches. */ |
| 1371 | else if (!NILP (spec_charset) | 1380 | else if (!NILP (spec_charset) |
| 1372 | && !EQ (spec_charset, Qiso10646_1) | 1381 | && !EQ (spec_charset, Qiso10646_1) |
| 1382 | && !EQ (spec_charset, Qunicode_bmp) | ||
| 1383 | && !EQ (spec_charset, Qunicode_sip) | ||
| 1373 | && match_data->pattern.lfCharSet == DEFAULT_CHARSET | 1384 | && match_data->pattern.lfCharSet == DEFAULT_CHARSET |
| 1374 | && logical_font->elfLogFont.lfCharSet != DEFAULT_CHARSET) | 1385 | && logical_font->elfLogFont.lfCharSet != DEFAULT_CHARSET) |
| 1375 | return 1; | 1386 | return 1; |