Mercurial > emacs
comparison src/w32fns.c @ 23620:2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
x font doesn't specify the charset.
(x_to_w32_charset): Change >= to == when testing results of stricmp.
author | Andrew Innes <andrewi@gnu.org> |
---|---|
date | Tue, 03 Nov 1998 22:21:58 +0000 |
parents | e4ba6b999a35 |
children | 54b22e0a1f7b |
comparison
equal
deleted
inserted
replaced
23619:0813c9bb52c4 | 23620:2b55b8f8cdc1 |
---|---|
4500 | 4500 |
4501 BLOCK_INPUT; | 4501 BLOCK_INPUT; |
4502 | 4502 |
4503 font->hfont = CreateFontIndirect (&lf); | 4503 font->hfont = CreateFontIndirect (&lf); |
4504 | 4504 |
4505 if (font->hfont == NULL) | 4505 if (font->hfont == NULL) |
4506 { | 4506 { |
4507 ok = FALSE; | 4507 ok = FALSE; |
4508 } | 4508 } |
4509 else | 4509 else |
4510 { | 4510 { |
4511 HDC hdc; | 4511 HDC hdc; |
4512 HANDLE oldobj; | 4512 HANDLE oldobj; |
4513 | 4513 |
4514 hdc = GetDC (dpyinfo->root_window); | 4514 hdc = GetDC (dpyinfo->root_window); |
4515 oldobj = SelectObject (hdc, font->hfont); | 4515 oldobj = SelectObject (hdc, font->hfont); |
4516 ok = GetTextMetrics (hdc, &font->tm); | 4516 ok = GetTextMetrics (hdc, &font->tm); |
4517 SelectObject (hdc, oldobj); | 4517 SelectObject (hdc, oldobj); |
4518 ReleaseDC (dpyinfo->root_window, hdc); | 4518 ReleaseDC (dpyinfo->root_window, hdc); |
4519 } | 4519 } |
4520 | 4520 |
4521 UNBLOCK_INPUT; | 4521 UNBLOCK_INPUT; |
4522 | 4522 |
4523 if (!ok) | 4523 if (!ok) |
4524 { | 4524 { |
4525 w32_unload_font (dpyinfo, font); | 4525 w32_unload_font (dpyinfo, font); |
4526 return (NULL); | 4526 return (NULL); |
4527 } | 4527 } |
4528 | 4528 |
4529 /* Do we need to create the table? */ | 4529 /* Do we need to create the table? */ |
4530 if (dpyinfo->font_table_size == 0) | 4530 if (dpyinfo->font_table_size == 0) |
4531 { | 4531 { |
4532 dpyinfo->font_table_size = 16; | 4532 dpyinfo->font_table_size = 16; |
4720 x_to_w32_charset (lpcs) | 4720 x_to_w32_charset (lpcs) |
4721 char * lpcs; | 4721 char * lpcs; |
4722 { | 4722 { |
4723 if (!lpcs) return (0); | 4723 if (!lpcs) return (0); |
4724 | 4724 |
4725 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; | 4725 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; |
4726 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; | 4726 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; |
4727 else if (stricmp (lpcs, "symbol") >= 0) return SYMBOL_CHARSET; | 4727 else if (stricmp (lpcs, "symbol") == 0) return SYMBOL_CHARSET; |
4728 else if (stricmp (lpcs, "jis") >= 0) return SHIFTJIS_CHARSET; | 4728 else if (stricmp (lpcs, "jis") == 0) return SHIFTJIS_CHARSET; |
4729 else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; | 4729 else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; |
4730 else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET; | 4730 else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET; |
4731 else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET; | 4731 else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET; |
4732 else if (stricmp (lpcs, "oem") >= 0) return OEM_CHARSET; | 4732 else if (stricmp (lpcs, "oem") == 0) return OEM_CHARSET; |
4733 | 4733 |
4734 #ifdef EASTEUROPE_CHARSET | 4734 #ifdef EASTEUROPE_CHARSET |
4735 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; | 4735 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; |
4736 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; | 4736 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; |
4737 else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET; | 4737 else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET; |
4745 else if (stricmp (lpcs, "tis620") == 0) return THAI_CHARSET; | 4745 else if (stricmp (lpcs, "tis620") == 0) return THAI_CHARSET; |
4746 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET; | 4746 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET; |
4747 #endif | 4747 #endif |
4748 | 4748 |
4749 #ifdef UNICODE_CHARSET | 4749 #ifdef UNICODE_CHARSET |
4750 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; | 4750 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; |
4751 else if (stricmp (lpcs, "unicode") >= 0) return UNICODE_CHARSET; | 4751 else if (stricmp (lpcs, "unicode") == 0) return UNICODE_CHARSET; |
4752 #endif | 4752 #endif |
4753 else if (lpcs[0] == '#') return atoi (lpcs + 1); | 4753 else if (lpcs[0] == '#') return atoi (lpcs + 1); |
4754 else | 4754 else |
4755 return DEFAULT_CHARSET; | 4755 return DEFAULT_CHARSET; |
4756 } | 4756 } |
4757 | 4757 |
4758 char * | 4758 char * |
4870 { | 4870 { |
4871 if (!lplogfont) return (FALSE); | 4871 if (!lplogfont) return (FALSE); |
4872 | 4872 |
4873 memset (lplogfont, 0, sizeof (*lplogfont)); | 4873 memset (lplogfont, 0, sizeof (*lplogfont)); |
4874 | 4874 |
4875 /* Set default value for each field. */ | |
4875 #if 1 | 4876 #if 1 |
4876 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; | 4877 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; |
4877 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; | 4878 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; |
4878 lplogfont->lfQuality = DEFAULT_QUALITY; | 4879 lplogfont->lfQuality = DEFAULT_QUALITY; |
4879 #else | 4880 #else |
4880 /* go for maximum quality */ | 4881 /* go for maximum quality */ |
4881 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS; | 4882 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS; |
4882 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS; | 4883 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS; |
4883 lplogfont->lfQuality = PROOF_QUALITY; | 4884 lplogfont->lfQuality = PROOF_QUALITY; |
4884 #endif | 4885 #endif |
4886 | |
4887 lplogfont->lfCharSet = DEFAULT_CHARSET; | |
4888 lplogfont->lfWeight = FW_DONTCARE; | |
4889 lplogfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; | |
4885 | 4890 |
4886 if (!lpxstr) | 4891 if (!lpxstr) |
4887 return FALSE; | 4892 return FALSE; |
4888 | 4893 |
4889 /* Provide a simple escape mechanism for specifying Windows font names | 4894 /* Provide a simple escape mechanism for specifying Windows font names |