diff options
| author | Geoff Voelker | 1999-01-22 19:58:37 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1999-01-22 19:58:37 +0000 |
| commit | 65c4903c49d2b3cc241d5030ef36e18e1d7d4a4b (patch) | |
| tree | b9c971a94db3058f65a95fce84da9c6c3e45f366 /src | |
| parent | 25d9ec8cc45ab2b1c0359859d4dc9bfbcb8ffa12 (diff) | |
| download | emacs-65c4903c49d2b3cc241d5030ef36e18e1d7d4a4b.tar.gz emacs-65c4903c49d2b3cc241d5030ef36e18e1d7d4a4b.zip | |
(W32_TEXTOUT): New macro.
(dumpglyphs): Support BDF fonts. Use W32_TEXTOUT macro.
Simplify baseline calculation. Detect SJIS by font, not glyph.
Call SetTextAlign.
(syms_of_w32term): Remove "jisx0212-sjis" from
w32-charset-to-codepage-alist.
Replace "ksc5601" with "ksc5601.1987" in w32-charset-to-codepage-alist.
Add "ksc5601.1992' to w32-charset-to-codepage-alist.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 287 |
1 files changed, 122 insertions, 165 deletions
diff --git a/src/w32term.c b/src/w32term.c index 12d476ff9a7..8a53ac2f7f2 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -542,6 +542,26 @@ w32_use_unicode_for_codepage (codepage) | |||
| 542 | #define BYTE2(ch) \ | 542 | #define BYTE2(ch) \ |
| 543 | (ch & 0x00ff) | 543 | (ch & 0x00ff) |
| 544 | 544 | ||
| 545 | #define W32_TEXTOUT(start_offset,nchars) \ | ||
| 546 | { \ | ||
| 547 | int charset_dim = CHARSET_DIMENSION(charset); \ | ||
| 548 | if (font->bdf) \ | ||
| 549 | w32_BDF_TextOut (font->bdf, hdc, left + xoffset, \ | ||
| 550 | top + yoffset, \ | ||
| 551 | x_1byte_buffer + start_offset, \ | ||
| 552 | charset_dim, charset_dim * nchars, 0); \ | ||
| 553 | else if (print_via_unicode) \ | ||
| 554 | ExtTextOutW (hdc, left + xoffset, top + yoffset, \ | ||
| 555 | fuOptions, clip_region, \ | ||
| 556 | x_2byte_buffer + start_offset, nchars, NULL); \ | ||
| 557 | else \ | ||
| 558 | ExtTextOut (hdc, left + xoffset, top + yoffset, \ | ||
| 559 | fuOptions, clip_region, \ | ||
| 560 | x_1byte_buffer + start_offset, \ | ||
| 561 | nchars * charset_dim, NULL); \ | ||
| 562 | start_offset += nchars * (print_via_unicode ? 1 : charset_dim ); \ | ||
| 563 | xoffset += nchars * glyph_width; \ | ||
| 564 | } | ||
| 545 | 565 | ||
| 546 | /* Display a sequence of N glyphs found at GP. | 566 | /* Display a sequence of N glyphs found at GP. |
| 547 | WINDOW is the window to output to. LEFT and TOP are starting coords. | 567 | WINDOW is the window to output to. LEFT and TOP are starting coords. |
| @@ -689,6 +709,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 689 | 2) A height of font is shorter than LINE_HEIGHT. | 709 | 2) A height of font is shorter than LINE_HEIGHT. |
| 690 | 3) Drawing a composite character. | 710 | 3) Drawing a composite character. |
| 691 | 4) Font has non-zero _MULE_BASELINE_OFFSET property. | 711 | 4) Font has non-zero _MULE_BASELINE_OFFSET property. |
| 712 | 5) Font is a bdf font. | ||
| 692 | After filling background, we draw glyphs by XDrawString16. */ | 713 | After filling background, we draw glyphs by XDrawString16. */ |
| 693 | int background_filled; | 714 | int background_filled; |
| 694 | /* Baseline position of a character, offset from TOP. */ | 715 | /* Baseline position of a character, offset from TOP. */ |
| @@ -698,6 +719,10 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 698 | int relative_compose = 0, default_ascent = 0; | 719 | int relative_compose = 0, default_ascent = 0; |
| 699 | /* 1 if we find no font or a font of inappropriate size. */ | 720 | /* 1 if we find no font or a font of inappropriate size. */ |
| 700 | int require_clipping; | 721 | int require_clipping; |
| 722 | RECT clip_rectangle; | ||
| 723 | LPRECT clip_region = NULL; | ||
| 724 | UINT fuOptions = 0; | ||
| 725 | |||
| 701 | int codepage = CP_DEFAULT; | 726 | int codepage = CP_DEFAULT; |
| 702 | BOOL print_via_unicode = FALSE; | 727 | BOOL print_via_unicode = FALSE; |
| 703 | 728 | ||
| @@ -744,21 +769,11 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 744 | 769 | ||
| 745 | font = (XFontStruct *) (fontp->font); | 770 | font = (XFontStruct *) (fontp->font); |
| 746 | codepage = w32_codepage_for_font (fontp->name); | 771 | codepage = w32_codepage_for_font (fontp->name); |
| 772 | |||
| 773 | if ( font && !font->bdf ) | ||
| 747 | print_via_unicode = w32_use_unicode_for_codepage (codepage); | 774 | print_via_unicode = w32_use_unicode_for_codepage (codepage); |
| 748 | 775 | ||
| 749 | /* tmLastChar will only exceed 255 if TEXTMETRICW is used | 776 | baseline = FONT_BASE (font) + fontp->baseline_offset; |
| 750 | (ie on NT but not on 95). In this case there is no harm | ||
| 751 | in being wrong, so have a go anyway. */ | ||
| 752 | baseline = | ||
| 753 | (font->tm.tmLastChar > 255 | ||
| 754 | ? (line_height + font->tm.tmAscent - font->tm.tmDescent) / 2 | ||
| 755 | : f->output_data.w32->font_baseline - fontp->baseline_offset); | ||
| 756 | if (FONT_HEIGHT (font) <= line_height | ||
| 757 | && (font->tm.tmAscent > baseline | ||
| 758 | || font->tm.tmDescent > line_height - baseline)) | ||
| 759 | /* Adjust baseline for this font to show the whole | ||
| 760 | glyphs in a line. */ | ||
| 761 | baseline = line_height - font->tm.tmDescent; | ||
| 762 | 777 | ||
| 763 | if (cmpcharp && cmpcharp->cmp_rule == NULL) | 778 | if (cmpcharp && cmpcharp->cmp_rule == NULL) |
| 764 | { | 779 | { |
| @@ -808,19 +823,6 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 808 | #endif | 823 | #endif |
| 809 | } | 824 | } |
| 810 | } | 825 | } |
| 811 | /* Japanese Kanji are a special case under w32, as they | ||
| 812 | must be printed in SJIS rather than EUC. */ | ||
| 813 | else if ((charset == charset_jisx0208) | ||
| 814 | || (charset == charset_jisx0208_1978) | ||
| 815 | || (charset == charset_id_internal ("japanese-jisx0212"))) | ||
| 816 | { | ||
| 817 | int sjis1, sjis2; | ||
| 818 | for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) | ||
| 819 | { | ||
| 820 | ENCODE_SJIS (BYTE1 (*cp), BYTE2 (*cp), sjis1, sjis2); | ||
| 821 | *cp = BUILD_WCHAR_T (sjis1, sjis2); | ||
| 822 | } | ||
| 823 | } | ||
| 824 | else if (fontp->encoding[charset]) | 826 | else if (fontp->encoding[charset]) |
| 825 | { | 827 | { |
| 826 | int enc = fontp->encoding[charset]; | 828 | int enc = fontp->encoding[charset]; |
| @@ -831,6 +833,26 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 831 | if (enc == 1 || enc == 3) | 833 | if (enc == 1 || enc == 3) |
| 832 | for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) | 834 | for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) |
| 833 | *cp = BUILD_WCHAR_T (BYTE1 (*cp), BYTE2 (*cp) | 0x80); | 835 | *cp = BUILD_WCHAR_T (BYTE1 (*cp), BYTE2 (*cp) | 0x80); |
| 836 | /* Special encoding for SJIS Kanji. */ | ||
| 837 | if (enc == 4) | ||
| 838 | { | ||
| 839 | if (CHARSET_DIMENSION (charset) == 2) | ||
| 840 | { | ||
| 841 | int sjis1, sjis2; | ||
| 842 | for (cp = x_2byte_buffer; | ||
| 843 | cp < x_2byte_buffer + len; cp++) | ||
| 844 | { | ||
| 845 | ENCODE_SJIS (BYTE1 (*cp), BYTE2 (*cp), | ||
| 846 | sjis1, sjis2); | ||
| 847 | *cp = BUILD_WCHAR_T (sjis1, sjis2); | ||
| 848 | } | ||
| 849 | } | ||
| 850 | else | ||
| 851 | for (cp = x_2byte_buffer; | ||
| 852 | cp < x_2byte_buffer + len; cp++) | ||
| 853 | *cp = BUILD_WCHAR_T (BYTE1 (*cp), | ||
| 854 | BYTE2 (*cp) | 0x80); | ||
| 855 | } | ||
| 834 | } | 856 | } |
| 835 | } | 857 | } |
| 836 | else | 858 | else |
| @@ -844,7 +866,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 844 | baseline = FONT_BASE (FRAME_FONT (f)); | 866 | baseline = FONT_BASE (FRAME_FONT (f)); |
| 845 | if (charset == charset_latin_iso8859_1) | 867 | if (charset == charset_latin_iso8859_1) |
| 846 | { | 868 | { |
| 847 | if (font->tm.tmLastChar < 0x80) | 869 | if (!font->bdf && font->tm.tmLastChar < 0x80) |
| 848 | /* This font can't display Latin1 characters. */ | 870 | /* This font can't display Latin1 characters. */ |
| 849 | font = NULL; | 871 | font = NULL; |
| 850 | else | 872 | else |
| @@ -911,11 +933,12 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 911 | 933 | ||
| 912 | if (font) | 934 | if (font) |
| 913 | require_clipping = (!NILP (Vclip_large_size_font) | 935 | require_clipping = (!NILP (Vclip_large_size_font) |
| 914 | && (font->tm.tmAscent > baseline | 936 | && ((font->bdf |
| 915 | || font->tm.tmDescent > | 937 | ? (font->bdf->ury > baseline |
| 916 | line_height - baseline | 938 | || font->bdf->lly > line_height - baseline) |
| 917 | || (!cmpcharp | 939 | : (font->tm.tmAscent > baseline |
| 918 | && FONT_MAX_WIDTH (font) > glyph_width))); | 940 | || font->tm.tmDescent > line_height - baseline)) |
| 941 | || (!cmpcharp && FONT_MAX_WIDTH (font) > glyph_width))); | ||
| 919 | 942 | ||
| 920 | if (font && (just_foreground || (cmpcharp && gidx > 0))) | 943 | if (font && (just_foreground || (cmpcharp && gidx > 0))) |
| 921 | background_filled = 1; | 944 | background_filled = 1; |
| @@ -923,6 +946,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 923 | /* Stippling not supported under w32. */ | 946 | /* Stippling not supported under w32. */ |
| 924 | 947 | ||
| 925 | else if (!font | 948 | else if (!font |
| 949 | || font->bdf | ||
| 926 | || FONT_HEIGHT (font) < line_height | 950 | || FONT_HEIGHT (font) < line_height |
| 927 | || FONT_WIDTH (font) < glyph_width | 951 | || FONT_WIDTH (font) < glyph_width |
| 928 | || FONT_MAX_WIDTH (font) != FONT_WIDTH (font) | 952 | || FONT_MAX_WIDTH (font) != FONT_WIDTH (font) |
| @@ -946,6 +970,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 946 | SetBkMode (hdc, background_filled ? TRANSPARENT : OPAQUE); | 970 | SetBkMode (hdc, background_filled ? TRANSPARENT : OPAQUE); |
| 947 | SetTextColor (hdc, fg); | 971 | SetTextColor (hdc, fg); |
| 948 | SetBkColor (hdc, bg); | 972 | SetBkColor (hdc, bg); |
| 973 | SetTextAlign (hdc, TA_BASELINE | TA_LEFT); | ||
| 949 | 974 | ||
| 950 | if ( print_via_unicode ) | 975 | if ( print_via_unicode ) |
| 951 | n_chars = MultiByteToWideChar | 976 | n_chars = MultiByteToWideChar |
| @@ -954,19 +979,18 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 954 | 979 | ||
| 955 | if (font) | 980 | if (font) |
| 956 | { | 981 | { |
| 982 | if (font->hfont) | ||
| 957 | SelectObject (hdc, font->hfont); | 983 | SelectObject (hdc, font->hfont); |
| 958 | 984 | ||
| 959 | if (!cmpcharp) | 985 | if (!cmpcharp) |
| 960 | { | 986 | { |
| 961 | int multibyte_pos_offset = 0; | 987 | int xoffset = 0, yoffset = baseline; |
| 962 | if (require_clipping || FONT_WIDTH (font) != glyph_width | 988 | if (require_clipping || FONT_WIDTH (font) != glyph_width |
| 963 | || FONT_MAX_WIDTH (font) != FONT_WIDTH (font)) | 989 | || FONT_MAX_WIDTH (font) != FONT_WIDTH (font)) |
| 964 | { | 990 | { |
| 965 | RECT clip_rectangle; | 991 | /* The incrementing of i in this loop is done |
| 966 | LPRECT clip_region = NULL; | 992 | inside the W32_CHAROUT macro. */ |
| 967 | UINT fuOptions = 0; | 993 | for (i = 0; i < n_chars; ) |
| 968 | |||
| 969 | for (i = 0; i < n_chars; i++) | ||
| 970 | { | 994 | { |
| 971 | if (require_clipping) | 995 | if (require_clipping) |
| 972 | { | 996 | { |
| @@ -979,42 +1003,13 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 979 | clip_rectangle.bottom = top + line_height; | 1003 | clip_rectangle.bottom = top + line_height; |
| 980 | clip_region = &clip_rectangle; | 1004 | clip_region = &clip_rectangle; |
| 981 | } | 1005 | } |
| 982 | 1006 | W32_TEXTOUT (i, 1); | |
| 983 | /* baseline works differently on w32 than X, | ||
| 984 | leave it out for now. */ | ||
| 985 | if (print_via_unicode) | ||
| 986 | ExtTextOutW (hdc, left + glyph_width * i, | ||
| 987 | top /*+ baseline*/, fuOptions, | ||
| 988 | clip_region, x_2byte_buffer + i, | ||
| 989 | 1, NULL); | ||
| 990 | else if (CHARSET_DIMENSION (charset) > 1) | ||
| 991 | { | ||
| 992 | /* Keep character together */ | ||
| 993 | int n = CHARSET_DIMENSION (charset) ; | ||
| 994 | ExtTextOut (hdc, left + multibyte_pos_offset, | ||
| 995 | top /*+ baseline*/, fuOptions, | ||
| 996 | clip_region, x_1byte_buffer + i, | ||
| 997 | n, NULL); | ||
| 998 | /* fiddle i. */ | ||
| 999 | i += n - 1; | ||
| 1000 | multibyte_pos_offset += glyph_width; | ||
| 1001 | } | ||
| 1002 | else | ||
| 1003 | ExtTextOut (hdc, left + glyph_width * i, | ||
| 1004 | top /*+ baseline*/, fuOptions, | ||
| 1005 | clip_region, x_1byte_buffer + i, | ||
| 1006 | 1, NULL); | ||
| 1007 | } | 1007 | } |
| 1008 | } | 1008 | } |
| 1009 | else | 1009 | else |
| 1010 | { | 1010 | { |
| 1011 | /* Print the whole run of characters. */ | 1011 | i = 0; |
| 1012 | if (print_via_unicode) | 1012 | W32_TEXTOUT (i, n_chars); |
| 1013 | TextOutW (hdc, left, top /*+ baseline*/, | ||
| 1014 | x_2byte_buffer, n_chars); | ||
| 1015 | else | ||
| 1016 | TextOut (hdc, left, top /*+ baseline*/, | ||
| 1017 | x_1byte_buffer, n_chars); | ||
| 1018 | } | 1013 | } |
| 1019 | } | 1014 | } |
| 1020 | else | 1015 | else |
| @@ -1042,7 +1037,9 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1042 | /* This is the first character. Initialize variables. | 1037 | /* This is the first character. Initialize variables. |
| 1043 | HIGHEST is the highest position of glyphs ever | 1038 | HIGHEST is the highest position of glyphs ever |
| 1044 | written, LOWEST the lowest position. */ | 1039 | written, LOWEST the lowest position. */ |
| 1045 | int x_offset = 0; | 1040 | int xoffset = 0; |
| 1041 | int yoffset = baseline; | ||
| 1042 | int start = 0; | ||
| 1046 | 1043 | ||
| 1047 | if (default_ascent | 1044 | if (default_ascent |
| 1048 | && CHAR_TABLE_P (Vuse_default_ascent) | 1045 | && CHAR_TABLE_P (Vuse_default_ascent) |
| @@ -1051,16 +1048,15 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1051 | highest = default_ascent; | 1048 | highest = default_ascent; |
| 1052 | lowest = 0; | 1049 | lowest = 0; |
| 1053 | } | 1050 | } |
| 1054 | else | 1051 | /* TODO: per char metrics for Truetype and BDF |
| 1052 | fonts. */ | ||
| 1055 | { | 1053 | { |
| 1056 | /* Per char metrics not supported on w32 - use | 1054 | highest = FONT_BASE (font) + 1; |
| 1057 | font's metrics. */ | 1055 | lowest = - (FONT_HEIGHT (font) - FONT_BASE (font)); |
| 1058 | highest = font->tm.tmAscent + 1; | ||
| 1059 | lowest = - font->tm.tmDescent; | ||
| 1060 | } | 1056 | } |
| 1061 | 1057 | ||
| 1062 | if (cmpcharp->cmp_rule) | 1058 | if (cmpcharp->cmp_rule) |
| 1063 | x_offset = (int)(cmpcharp->col_offset[0] | 1059 | xoffset = (int)(cmpcharp->col_offset[0] |
| 1064 | * FONT_WIDTH (FRAME_FONT (f))); | 1060 | * FONT_WIDTH (FRAME_FONT (f))); |
| 1065 | 1061 | ||
| 1066 | i = 1; | 1062 | i = 1; |
| @@ -1080,46 +1076,27 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1080 | { | 1076 | { |
| 1081 | char_width = char_placement.abcA | 1077 | char_width = char_placement.abcA |
| 1082 | + char_placement.abcB + char_placement.abcC; | 1078 | + char_placement.abcB + char_placement.abcC; |
| 1083 | x_offset += FONT_WIDTH (font) - char_width; | 1079 | xoffset += FONT_WIDTH (font) - char_width; |
| 1084 | } | 1080 | } |
| 1085 | /* Don't let characters go beyond the glyph | 1081 | /* Don't let characters go beyond the glyph |
| 1086 | boundary whatever their over/underhangs. */ | 1082 | boundary whatever their over/underhangs. */ |
| 1087 | if (x_offset > glyph_width - char_width) | 1083 | if (xoffset > glyph_width - char_width) |
| 1088 | x_offset = glyph_width - char_width; | 1084 | xoffset = glyph_width - char_width; |
| 1089 | 1085 | ||
| 1090 | if (x_offset < 0) | 1086 | if (xoffset < 0) |
| 1091 | x_offset = 0; | 1087 | xoffset = 0; |
| 1092 | 1088 | ||
| 1093 | /* Draw the first character at the normal position. */ | 1089 | /* Draw the first character at the normal |
| 1094 | if (print_via_unicode) | 1090 | position. */ |
| 1095 | ExtTextOutW (hdc, left + x_offset, | 1091 | W32_TEXTOUT (start, 1); |
| 1096 | top /*+ baseline*/, | ||
| 1097 | fuOptions, clip_region, | ||
| 1098 | x_2byte_buffer, 1, NULL); | ||
| 1099 | else if (CHARSET_DIMENSION (charset) > 1) | ||
| 1100 | { | ||
| 1101 | /* Keep character together */ | ||
| 1102 | int n = CHARSET_DIMENSION (charset) ; | ||
| 1103 | ExtTextOut (hdc, left + x_offset, | ||
| 1104 | top /*+ baseline*/, | ||
| 1105 | fuOptions, clip_region, | ||
| 1106 | x_1byte_buffer, n, NULL); | ||
| 1107 | /* fiddle i. */ | ||
| 1108 | i += n - 1; | ||
| 1109 | } | ||
| 1110 | else | ||
| 1111 | ExtTextOut (hdc, left + x_offset, | ||
| 1112 | top /*+ baseline*/, | ||
| 1113 | fuOptions, clip_region, | ||
| 1114 | x_1byte_buffer, 1, NULL); | ||
| 1115 | gidx++; | 1092 | gidx++; |
| 1116 | } | 1093 | } |
| 1117 | else | 1094 | else |
| 1118 | i = 0; | 1095 | i = 0; |
| 1119 | 1096 | ||
| 1120 | for (; i < n_chars; i++, gidx++) | 1097 | for (; i < n_chars; gidx++) |
| 1121 | { | 1098 | { |
| 1122 | int x_offset = 0, y_offset = 0; | 1099 | int xoffset = 0, yoffset = FONT_BASE (font); |
| 1123 | 1100 | ||
| 1124 | if (relative_compose) | 1101 | if (relative_compose) |
| 1125 | { | 1102 | { |
| @@ -1128,19 +1105,18 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1128 | || NILP (Faref (Vignore_relative_composition, | 1105 | || NILP (Faref (Vignore_relative_composition, |
| 1129 | make_number (cmpcharp->glyph[gidx])))) | 1106 | make_number (cmpcharp->glyph[gidx])))) |
| 1130 | { | 1107 | { |
| 1131 | if (- font->tm.tmDescent >= relative_compose) | 1108 | if (- (FONT_HEIGHT (font) - FONT_BASE (font)) |
| 1109 | >= relative_compose) | ||
| 1132 | { | 1110 | { |
| 1133 | /* Draw above the current glyphs. */ | 1111 | /* Draw above the current glyphs. */ |
| 1134 | y_offset = highest + font->tm.tmDescent; | 1112 | yoffset = highest + FONT_HEIGHT (font); |
| 1135 | highest += font->tm.tmAscent | 1113 | highest += FONT_HEIGHT (font); |
| 1136 | + font->tm.tmDescent; | ||
| 1137 | } | 1114 | } |
| 1138 | else if (font->tm.tmAscent <= 0) | 1115 | else if (FONT_BASE (font) <= 0) |
| 1139 | { | 1116 | { |
| 1140 | /* Draw beneath the current glyphs. */ | 1117 | /* Draw beneath the current glyphs. */ |
| 1141 | y_offset = lowest - font->tm.tmAscent; | 1118 | yoffset = lowest; |
| 1142 | lowest -= font->tm.tmAscent | 1119 | lowest -= FONT_HEIGHT (font); |
| 1143 | + font->tm.tmDescent; | ||
| 1144 | } | 1120 | } |
| 1145 | } | 1121 | } |
| 1146 | else | 1122 | else |
| @@ -1148,10 +1124,12 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1148 | /* Draw the glyph at normal position. If | 1124 | /* Draw the glyph at normal position. If |
| 1149 | it sticks out of HIGHEST or LOWEST, | 1125 | it sticks out of HIGHEST or LOWEST, |
| 1150 | update them appropriately. */ | 1126 | update them appropriately. */ |
| 1151 | if (font->tm.tmAscent > highest) | 1127 | if (FONT_BASE (font) > highest) |
| 1152 | highest = font->tm.tmAscent; | 1128 | highest = FONT_BASE (font); |
| 1153 | else if (- font->tm.tmDescent < lowest) | 1129 | else if (- (FONT_HEIGHT (font) - FONT_BASE (font)) |
| 1154 | lowest = - font->tm.tmDescent; | 1130 | < lowest) |
| 1131 | lowest = - (FONT_HEIGHT (font) - | ||
| 1132 | FONT_BASE (font)); | ||
| 1155 | } | 1133 | } |
| 1156 | } | 1134 | } |
| 1157 | else if (cmpcharp->cmp_rule) | 1135 | else if (cmpcharp->cmp_rule) |
| @@ -1170,20 +1148,19 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1170 | bottom = ((gref == 0 ? highest : gref == 1 ? 0 | 1148 | bottom = ((gref == 0 ? highest : gref == 1 ? 0 |
| 1171 | : gref == 2 ? lowest | 1149 | : gref == 2 ? lowest |
| 1172 | : (highest + lowest) / 2) | 1150 | : (highest + lowest) / 2) |
| 1173 | - (nref == 0 ? font->tm.tmAscent | 1151 | - (nref == 0 ? FONT_HEIGHT (font) |
| 1174 | + font->tm.tmDescent | 1152 | : nref == 1 ? (FONT_HEIGHT (font) - |
| 1175 | : nref == 1 ? font->tm.tmDescent | 1153 | FONT_BASE (font)) |
| 1176 | : nref == 2 ? 0 | 1154 | : nref == 2 ? 0 |
| 1177 | : (font->tm.tmAscent + | 1155 | : (FONT_HEIGHT (font) / 2))); |
| 1178 | font->tm.tmDescent) / 2)); | 1156 | top = bottom + FONT_HEIGHT (font); |
| 1179 | top = bottom + (font->tm.tmAscent + | 1157 | |
| 1180 | font->tm.tmDescent); | ||
| 1181 | if (top > highest) | 1158 | if (top > highest) |
| 1182 | highest = top; | 1159 | highest = top; |
| 1183 | if (bottom < lowest) | 1160 | if (bottom < lowest) |
| 1184 | lowest = bottom; | 1161 | lowest = bottom; |
| 1185 | y_offset = bottom + font->tm.tmDescent; | 1162 | yoffset = bottom + FONT_HEIGHT (font); |
| 1186 | x_offset = (int)(cmpcharp->col_offset[gidx] | 1163 | xoffset = (int)(cmpcharp->col_offset[gidx] |
| 1187 | * FONT_WIDTH (FRAME_FONT(f))); | 1164 | * FONT_WIDTH (FRAME_FONT(f))); |
| 1188 | } | 1165 | } |
| 1189 | 1166 | ||
| @@ -1202,37 +1179,17 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1202 | { | 1179 | { |
| 1203 | char_width = char_placement.abcA | 1180 | char_width = char_placement.abcA |
| 1204 | + char_placement.abcB + char_placement.abcC; | 1181 | + char_placement.abcB + char_placement.abcC; |
| 1205 | x_offset += FONT_WIDTH (font) - char_width; | 1182 | xoffset += FONT_WIDTH (font) - char_width; |
| 1206 | } | 1183 | } |
| 1207 | /* Don't let characters go beyond the glyph | 1184 | /* Don't let characters go beyond the glyph |
| 1208 | boundary whatever their over/underhangs. */ | 1185 | boundary whatever their over/underhangs. */ |
| 1209 | if (x_offset > glyph_width - char_width) | 1186 | if (xoffset > glyph_width - char_width) |
| 1210 | x_offset = glyph_width - char_width; | 1187 | xoffset = glyph_width - char_width; |
| 1211 | 1188 | ||
| 1212 | if (x_offset < 0) | 1189 | if (xoffset < 0) |
| 1213 | x_offset = 0; | 1190 | xoffset = 0; |
| 1214 | 1191 | ||
| 1215 | if (print_via_unicode) | 1192 | W32_TEXTOUT (i, 1); |
| 1216 | ExtTextOutW (hdc, left + x_offset, | ||
| 1217 | top /*+ baseline - y_offset*/, | ||
| 1218 | fuOptions, clip_region, | ||
| 1219 | x_2byte_buffer + i, 1, NULL); | ||
| 1220 | else if (CHARSET_DIMENSION (charset) > 1) | ||
| 1221 | { | ||
| 1222 | /* Keep character together */ | ||
| 1223 | int n = CHARSET_DIMENSION (charset) ; | ||
| 1224 | ExtTextOut (hdc, left + x_offset, | ||
| 1225 | top /*+ baseline - y_offset*/, | ||
| 1226 | fuOptions, clip_region, | ||
| 1227 | x_1byte_buffer + i, n, NULL); | ||
| 1228 | /* fiddle i. */ | ||
| 1229 | i += n - 1; | ||
| 1230 | } | ||
| 1231 | else | ||
| 1232 | ExtTextOut (hdc, left + x_offset, | ||
| 1233 | top /*+ baseline - y_offset*/, | ||
| 1234 | fuOptions, clip_region, | ||
| 1235 | x_1byte_buffer + i, 1, NULL); | ||
| 1236 | } | 1193 | } |
| 1237 | } | 1194 | } |
| 1238 | } | 1195 | } |
| @@ -1266,8 +1223,10 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1266 | on the default font of this frame. */ | 1223 | on the default font of this frame. */ |
| 1267 | int underline_position = 1; | 1224 | int underline_position = 1; |
| 1268 | 1225 | ||
| 1269 | if (FRAME_FONT (f)->tm.tmDescent <= underline_position) | 1226 | if (FONT_HEIGHT (FRAME_FONT (f)) - FONT_BASE(FRAME_FONT (f)) |
| 1270 | underline_position = FRAME_FONT (f)->tm.tmDescent - 1; | 1227 | <= underline_position) |
| 1228 | underline_position = (FONT_HEIGHT (FRAME_FONT (f)) - | ||
| 1229 | FONT_BASE(FRAME_FONT (f))) - 1; | ||
| 1271 | 1230 | ||
| 1272 | if (face->underline) | 1231 | if (face->underline) |
| 1273 | w32_fill_area (f, hdc, fg, left, | 1232 | w32_fill_area (f, hdc, fg, left, |
| @@ -4178,7 +4137,7 @@ x_new_font (f, fontname) | |||
| 4178 | 4137 | ||
| 4179 | FRAME_FONT (f) = (XFontStruct *) (fontp->font); | 4138 | FRAME_FONT (f) = (XFontStruct *) (fontp->font); |
| 4180 | f->output_data.w32->font_baseline | 4139 | f->output_data.w32->font_baseline |
| 4181 | = FRAME_FONT(f)->tm.tmAscent + fontp->baseline_offset; | 4140 | = FONT_BASE (FRAME_FONT (f)) + fontp->baseline_offset; |
| 4182 | FRAME_FONTSET (f) = -1; | 4141 | FRAME_FONTSET (f) = -1; |
| 4183 | 4142 | ||
| 4184 | /* Compute the scroll bar width in character columns. */ | 4143 | /* Compute the scroll bar width in character columns. */ |
| @@ -5155,7 +5114,6 @@ NT uses Unicode internally anyway, so this flag will probably have no\n\ | |||
| 5155 | affect on NT machines."); | 5114 | affect on NT machines."); |
| 5156 | w32_enable_unicode_output = 1; | 5115 | w32_enable_unicode_output = 1; |
| 5157 | 5116 | ||
| 5158 | /* w32-charset-to-codepage-alist is initialized in w32-win.el. */ | ||
| 5159 | DEFVAR_LISP ("w32-charset-to-codepage-alist", | 5117 | DEFVAR_LISP ("w32-charset-to-codepage-alist", |
| 5160 | &Vw32_charset_to_codepage_alist, | 5118 | &Vw32_charset_to_codepage_alist, |
| 5161 | "Alist linking character sets to Windows Codepages."); | 5119 | "Alist linking character sets to Windows Codepages."); |
| @@ -5169,11 +5127,10 @@ affect on NT machines."); | |||
| 5169 | build_string ("big5"), codepage); | 5127 | build_string ("big5"), codepage); |
| 5170 | XSETFASTINT (codepage, 949); | 5128 | XSETFASTINT (codepage, 949); |
| 5171 | store_in_alist (&Vw32_charset_to_codepage_alist, | 5129 | store_in_alist (&Vw32_charset_to_codepage_alist, |
| 5172 | build_string ("ksc5601"), codepage); | 5130 | build_string ("ksc5601.1987"), codepage); |
| 5173 | XSETFASTINT (codepage, 932); | 5131 | XSETFASTINT (codepage, 1361); |
| 5174 | /* SJIS only contains a subset of JISX0212, but list it anyway. */ | ||
| 5175 | store_in_alist (&Vw32_charset_to_codepage_alist, | 5132 | store_in_alist (&Vw32_charset_to_codepage_alist, |
| 5176 | build_string ("jisx0212-sjis"), codepage); | 5133 | build_string ("ksc5601.1992"), codepage); |
| 5177 | XSETFASTINT (codepage, 932); | 5134 | XSETFASTINT (codepage, 932); |
| 5178 | store_in_alist (&Vw32_charset_to_codepage_alist, | 5135 | store_in_alist (&Vw32_charset_to_codepage_alist, |
| 5179 | build_string ("jisx0208-sjis"), codepage); | 5136 | build_string ("jisx0208-sjis"), codepage); |