aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorMiles Bader2006-02-22 06:54:10 +0000
committerMiles Bader2006-02-22 06:54:10 +0000
commitb434f199dbbc2694a69538ee95e5e583f6357f71 (patch)
treeea87d2540063659d9cfdb24462bb4c0336a6ec47 /src/macterm.c
parent9d826e0eaf8a4e2f1cf5aac74d6b02ccc393af8d (diff)
parenta1b24e137f75b9f5fdbd5526947a70c462c5e5bf (diff)
downloademacs-b434f199dbbc2694a69538ee95e5e583f6357f71.tar.gz
emacs-b434f199dbbc2694a69538ee95e5e583f6357f71.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-21
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 97-112) - Update from CVS - Merge from erc--emacs--0 - Update from CVS: src/regex.c (extend_range_table_work_area): Fix typo. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 37) - Update from CVS
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c324
1 files changed, 179 insertions, 145 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 8439a79d65c..78ea90bfc8b 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -285,7 +285,7 @@ mac_begin_clip (region)
285 if (new_region == NULL) 285 if (new_region == NULL)
286 new_region = NewRgn (); 286 new_region = NewRgn ();
287 287
288 if (region) 288 if (region && !EmptyRgn (region))
289 { 289 {
290 GetClip (saved_port_clip_region); 290 GetClip (saved_port_clip_region);
291 SectRgn (saved_port_clip_region, region, new_region); 291 SectRgn (saved_port_clip_region, region, new_region);
@@ -297,7 +297,7 @@ static void
297mac_end_clip (region) 297mac_end_clip (region)
298 RgnHandle region; 298 RgnHandle region;
299{ 299{
300 if (region) 300 if (region && !EmptyRgn (region))
301 SetClip (saved_port_clip_region); 301 SetClip (saved_port_clip_region);
302} 302}
303 303
@@ -684,27 +684,15 @@ mac_invert_rectangle (f, x, y, width, height)
684 684
685 685
686static void 686static void
687mac_draw_string_common (f, gc, x, y, buf, nchars, mode, bytes_per_char) 687mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
688 struct frame *f; 688 struct frame *f;
689 GC gc; 689 GC gc;
690 int x, y; 690 int x, y;
691 char *buf; 691 char *buf;
692 int nchars, mode, bytes_per_char; 692 int nchars, bg_width, bytes_per_char;
693{ 693{
694#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
695 UInt32 textFlags, savedFlags;
696 if (mac_use_core_graphics) {
697 textFlags = kQDUseCGTextRendering;
698 savedFlags = SwapQDTextFlags(textFlags);
699 }
700#endif
701
702 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 694 SetPortWindowPort (FRAME_MAC_WINDOW (f));
703 695
704 RGBForeColor (GC_FORE_COLOR (gc));
705 if (mode != srcOr)
706 RGBBackColor (GC_BACK_COLOR (gc));
707
708#if USE_ATSUI 696#if USE_ATSUI
709 if (GC_FONT (gc)->mac_style) 697 if (GC_FONT (gc)->mac_style)
710 { 698 {
@@ -726,91 +714,144 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, mode, bytes_per_char)
726 nchars, 714 nchars,
727 GC_FONT (gc)->mac_style, 715 GC_FONT (gc)->mac_style,
728 &text_layout); 716 &text_layout);
729 if (err == noErr) 717 if (err != noErr)
730 { 718 return;
731#ifdef MAC_OSX 719#ifdef MAC_OSX
732 if (!mac_use_core_graphics) 720 if (!mac_use_core_graphics)
733 { 721 {
734#endif 722#endif
735 mac_begin_clip (GC_CLIP_REGION (gc)); 723 mac_begin_clip (GC_CLIP_REGION (gc));
736 MoveTo (x, y); 724 RGBForeColor (GC_FORE_COLOR (gc));
737 ATSUDrawText (text_layout, 725 if (bg_width)
738 kATSUFromTextBeginning, kATSUToTextEnd, 726 {
739 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); 727 Rect r;
740 mac_end_clip (GC_CLIP_REGION (gc)); 728
741#ifdef MAC_OSX 729 SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)),
730 x + bg_width, y + FONT_DESCENT (GC_FONT (gc)));
731 RGBBackColor (GC_BACK_COLOR (gc));
732 EraseRect (&r);
733 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
742 } 734 }
743 else 735 MoveTo (x, y);
736 ATSUDrawText (text_layout,
737 kATSUFromTextBeginning, kATSUToTextEnd,
738 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
739 mac_end_clip (GC_CLIP_REGION (gc));
740#ifdef MAC_OSX
741 }
742 else
743 {
744 CGrafPtr port;
745 CGContextRef context;
746 float port_height = FRAME_PIXEL_HEIGHT (f);
747 ATSUAttributeTag tags[] = {kATSUCGContextTag};
748 ByteCount sizes[] = {sizeof (CGContextRef)};
749 ATSUAttributeValuePtr values[] = {&context};
750
751 GetPort (&port);
752 QDBeginCGContext (port, &context);
753 if (gc->n_clip_rects || bg_width)
744 { 754 {
745 CGrafPtr port; 755 CGContextTranslateCTM (context, 0, port_height);
746 CGContextRef context; 756 CGContextScaleCTM (context, 1, -1);
747 float port_height = FRAME_PIXEL_HEIGHT (f);
748 ATSUAttributeTag tags[] = {kATSUCGContextTag};
749 ByteCount sizes[] = {sizeof (CGContextRef)};
750 ATSUAttributeValuePtr values[] = {&context};
751
752 GetPort (&port);
753 QDBeginCGContext (port, &context);
754 if (gc->n_clip_rects) 757 if (gc->n_clip_rects)
758 CGContextClipToRects (context, gc->clip_rects,
759 gc->n_clip_rects);
760 if (bg_width)
755 { 761 {
756 CGContextTranslateCTM (context, 0, port_height); 762 CGContextSetRGBFillColor
757 CGContextScaleCTM (context, 1, -1); 763 (context,
758 CGContextClipToRects (context, gc->clip_rects, 764 RED_FROM_ULONG (gc->xgcv.background) / 255.0f,
759 gc->n_clip_rects); 765 GREEN_FROM_ULONG (gc->xgcv.background) / 255.0f,
760 CGContextScaleCTM (context, 1, -1); 766 BLUE_FROM_ULONG (gc->xgcv.background) / 255.0f,
761 CGContextTranslateCTM (context, 0, -port_height); 767 1.0);
768 CGContextFillRect
769 (context,
770 CGRectMake (x, y - FONT_BASE (GC_FONT (gc)),
771 bg_width, FONT_HEIGHT (GC_FONT (gc))));
762 } 772 }
763 CGContextSetRGBFillColor 773 CGContextScaleCTM (context, 1, -1);
764 (context, 774 CGContextTranslateCTM (context, 0, -port_height);
765 RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, 775 }
766 GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0, 776 CGContextSetRGBFillColor
767 BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0, 777 (context,
768 1.0); 778 RED_FROM_ULONG (gc->xgcv.foreground) / 255.0f,
769 err = ATSUSetLayoutControls (text_layout, 779 GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0f,
770 sizeof (tags) / sizeof (tags[0]), 780 BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0f,
771 tags, sizes, values); 781 1.0);
772 if (err == noErr) 782 err = ATSUSetLayoutControls (text_layout,
773 ATSUDrawText (text_layout,
774 kATSUFromTextBeginning, kATSUToTextEnd,
775 Long2Fix (x), Long2Fix (port_height - y));
776 CGContextSynchronize (context);
777 QDEndCGContext (port, &context);
778#if 0
779 /* This doesn't work on Mac OS X 10.1. */
780 ATSUClearLayoutControls (text_layout,
781 sizeof (tags) / sizeof (tags[0]), 783 sizeof (tags) / sizeof (tags[0]),
782 tags); 784 tags, sizes, values);
785 if (err == noErr)
786 ATSUDrawText (text_layout,
787 kATSUFromTextBeginning, kATSUToTextEnd,
788 Long2Fix (x), Long2Fix (port_height - y));
789 CGContextSynchronize (context);
790 QDEndCGContext (port, &context);
791#if 0
792 /* This doesn't work on Mac OS X 10.1. */
793 ATSUClearLayoutControls (text_layout,
794 sizeof (tags) / sizeof (tags[0]), tags);
783#else 795#else
784 ATSUSetLayoutControls (text_layout, 796 ATSUSetLayoutControls (text_layout,
785 sizeof (tags) / sizeof (tags[0]), 797 sizeof (tags) / sizeof (tags[0]),
786 tags, sizes, values); 798 tags, sizes, values);
787#endif
788 }
789#endif 799#endif
790 } 800 }
801#endif /* MAC_OSX */
791 } 802 }
792 else 803 else
804#endif /* USE_ATSUI */
793 { 805 {
806#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
807 UInt32 savedFlags;
808
809 if (mac_use_core_graphics)
810 savedFlags = SwapQDTextFlags (kQDUseCGTextRendering);
794#endif 811#endif
795 TextFont (GC_FONT (gc)->mac_fontnum); 812 mac_begin_clip (GC_CLIP_REGION (gc));
796 TextSize (GC_FONT (gc)->mac_fontsize); 813 RGBForeColor (GC_FORE_COLOR (gc));
797 TextFace (GC_FONT (gc)->mac_fontface); 814#ifdef MAC_OS8
798 TextMode (mode); 815 if (bg_width)
816 {
817 RGBBackColor (GC_BACK_COLOR (gc));
818 TextMode (srcCopy);
819 }
820 else
821 TextMode (srcOr);
822#else
823 /* We prefer not to use srcCopy text transfer mode on Mac OS X
824 because:
825 - Screen is double-buffered. (In srcCopy mode, a text is
826 drawn into an offscreen graphics world first. So
827 performance gain cannot be expected.)
828 - It lowers rendering quality.
829 - Some fonts leave garbage on cursor movement. */
830 if (bg_width)
831 {
832 Rect r;
799 833
800 mac_begin_clip (GC_CLIP_REGION (gc)); 834 RGBBackColor (GC_BACK_COLOR (gc));
801 MoveTo (x, y); 835 SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)),
802 DrawText (buf, 0, nchars * bytes_per_char); 836 x + bg_width, y + FONT_DESCENT (GC_FONT (gc)));
803 mac_end_clip (GC_CLIP_REGION (gc)); 837 EraseRect (&r);
804#if USE_ATSUI 838 }
805 } 839 TextMode (srcOr);
806#endif 840#endif
841 TextFont (GC_FONT (gc)->mac_fontnum);
842 TextSize (GC_FONT (gc)->mac_fontsize);
843 TextFace (GC_FONT (gc)->mac_fontface);
844 MoveTo (x, y);
845 DrawText (buf, 0, nchars * bytes_per_char);
846 if (bg_width)
847 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
848 mac_end_clip (GC_CLIP_REGION (gc));
807 849
808 if (mode != srcOr)
809 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
810#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 850#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
811 if (mac_use_core_graphics) 851 if (mac_use_core_graphics)
812 SwapQDTextFlags(savedFlags); 852 SwapQDTextFlags(savedFlags);
813#endif 853#endif
854 }
814} 855}
815 856
816 857
@@ -824,7 +865,7 @@ mac_draw_string (f, gc, x, y, buf, nchars)
824 char *buf; 865 char *buf;
825 int nchars; 866 int nchars;
826{ 867{
827 mac_draw_string_common (f, gc, x, y, buf, nchars, srcOr, 1); 868 mac_draw_string_common (f, gc, x, y, buf, nchars, 0, 1);
828} 869}
829 870
830 871
@@ -838,35 +879,35 @@ mac_draw_string_16 (f, gc, x, y, buf, nchars)
838 XChar2b *buf; 879 XChar2b *buf;
839 int nchars; 880 int nchars;
840{ 881{
841 mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, srcOr, 2); 882 mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, 0, 2);
842} 883}
843 884
844 885
845/* Mac replacement for XDrawImageString. */ 886/* Mac replacement for XDrawImageString. */
846 887
847static void 888static void
848mac_draw_image_string (f, gc, x, y, buf, nchars) 889mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width)
849 struct frame *f; 890 struct frame *f;
850 GC gc; 891 GC gc;
851 int x, y; 892 int x, y;
852 char *buf; 893 char *buf;
853 int nchars; 894 int nchars, bg_width;
854{ 895{
855 mac_draw_string_common (f, gc, x, y, buf, nchars, srcCopy, 1); 896 mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, 1);
856} 897}
857 898
858 899
859/* Mac replacement for XDrawString16. */ 900/* Mac replacement for XDrawString16. */
860 901
861static void 902static void
862mac_draw_image_string_16 (f, gc, x, y, buf, nchars) 903mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width)
863 struct frame *f; 904 struct frame *f;
864 GC gc; 905 GC gc;
865 int x, y; 906 int x, y;
866 XChar2b *buf; 907 XChar2b *buf;
867 int nchars; 908 int nchars, bg_width;
868{ 909{
869 mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, srcCopy, 2); 910 mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width, 2);
870} 911}
871 912
872 913
@@ -1040,12 +1081,12 @@ init_cg_text_anti_aliasing_threshold ()
1040} 1081}
1041 1082
1042static int 1083static int
1043mac_draw_string_cg (f, gc, x, y, buf, nchars) 1084mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width)
1044 struct frame *f; 1085 struct frame *f;
1045 GC gc; 1086 GC gc;
1046 int x, y; 1087 int x, y;
1047 XChar2b *buf; 1088 XChar2b *buf;
1048 int nchars; 1089 int nchars, bg_width;
1049{ 1090{
1050 CGrafPtr port; 1091 CGrafPtr port;
1051 float port_height, gx, gy; 1092 float port_height, gx, gy;
@@ -1062,7 +1103,9 @@ mac_draw_string_cg (f, gc, x, y, buf, nchars)
1062 gx = x; 1103 gx = x;
1063 gy = port_height - y; 1104 gy = port_height - y;
1064 glyphs = (CGGlyph *)buf; 1105 glyphs = (CGGlyph *)buf;
1065 advances = xmalloc (sizeof (CGSize) * nchars); 1106 advances = alloca (sizeof (CGSize) * nchars);
1107 if (advances == NULL)
1108 return 0;
1066 for (i = 0; i < nchars; i++) 1109 for (i = 0; i < nchars; i++)
1067 { 1110 {
1068 XCharStruct *pcm = mac_per_char_metric (GC_FONT (gc), buf, 0); 1111 XCharStruct *pcm = mac_per_char_metric (GC_FONT (gc), buf, 0);
@@ -1074,18 +1117,32 @@ mac_draw_string_cg (f, gc, x, y, buf, nchars)
1074 } 1117 }
1075 1118
1076 QDBeginCGContext (port, &context); 1119 QDBeginCGContext (port, &context);
1077 if (gc->n_clip_rects) 1120 if (gc->n_clip_rects || bg_width)
1078 { 1121 {
1079 CGContextTranslateCTM (context, 0, port_height); 1122 CGContextTranslateCTM (context, 0, port_height);
1080 CGContextScaleCTM (context, 1, -1); 1123 CGContextScaleCTM (context, 1, -1);
1081 CGContextClipToRects (context, gc->clip_rects, gc->n_clip_rects); 1124 if (gc->n_clip_rects)
1125 CGContextClipToRects (context, gc->clip_rects, gc->n_clip_rects);
1126 if (bg_width)
1127 {
1128 CGContextSetRGBFillColor
1129 (context,
1130 RED_FROM_ULONG (gc->xgcv.background) / 255.0f,
1131 GREEN_FROM_ULONG (gc->xgcv.background) / 255.0f,
1132 BLUE_FROM_ULONG (gc->xgcv.background) / 255.0f,
1133 1.0);
1134 CGContextFillRect
1135 (context,
1136 CGRectMake (gx, y - FONT_BASE (GC_FONT (gc)),
1137 bg_width, FONT_HEIGHT (GC_FONT (gc))));
1138 }
1082 CGContextScaleCTM (context, 1, -1); 1139 CGContextScaleCTM (context, 1, -1);
1083 CGContextTranslateCTM (context, 0, -port_height); 1140 CGContextTranslateCTM (context, 0, -port_height);
1084 } 1141 }
1085 CGContextSetRGBFillColor (context, 1142 CGContextSetRGBFillColor (context,
1086 RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, 1143 RED_FROM_ULONG (gc->xgcv.foreground) / 255.0f,
1087 GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0, 1144 GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0f,
1088 BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0, 1145 BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0f,
1089 1.0); 1146 1.0);
1090 CGContextSetFont (context, GC_FONT (gc)->cg_font); 1147 CGContextSetFont (context, GC_FONT (gc)->cg_font);
1091 CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize); 1148 CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize);
@@ -1104,8 +1161,6 @@ mac_draw_string_cg (f, gc, x, y, buf, nchars)
1104 CGContextSynchronize (context); 1161 CGContextSynchronize (context);
1105 QDEndCGContext (port, &context); 1162 QDEndCGContext (port, &context);
1106 1163
1107 xfree (advances);
1108
1109 return 1; 1164 return 1;
1110} 1165}
1111#endif 1166#endif
@@ -1377,10 +1432,7 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
1377 if (n == 0) 1432 if (n == 0)
1378 { 1433 {
1379 if (gc->clip_region) 1434 if (gc->clip_region)
1380 { 1435 SetEmptyRgn (gc->clip_region);
1381 DisposeRgn (gc->clip_region);
1382 gc->clip_region = NULL;
1383 }
1384 } 1436 }
1385 else 1437 else
1386 { 1438 {
@@ -2324,14 +2376,6 @@ x_clear_glyph_string_rect (s, x, y, w, h)
2324} 2376}
2325 2377
2326 2378
2327/* We prefer not to use XDrawImageString (srcCopy text transfer mode)
2328 on Mac OS X because:
2329 - Screen is double-buffered. (In srcCopy mode, a text is drawn
2330 into an offscreen graphics world first. So performance gain
2331 cannot be expected.)
2332 - It lowers rendering quality.
2333 - Some fonts leave garbage on cursor movement. */
2334
2335/* Draw the background of glyph_string S. If S->background_filled_p 2379/* Draw the background of glyph_string S. If S->background_filled_p
2336 is non-zero don't draw it. FORCE_P non-zero means draw the 2380 is non-zero don't draw it. FORCE_P non-zero means draw the
2337 background even if it wouldn't be drawn normally. This is used 2381 background even if it wouldn't be drawn normally. This is used
@@ -2363,12 +2407,10 @@ x_draw_glyph_string_background (s, force_p)
2363 } 2407 }
2364 else 2408 else
2365#endif 2409#endif
2366#if defined (MAC_OS8) && !USE_ATSUI
2367 if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width 2410 if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
2368 || s->font_not_found_p 2411 || s->font_not_found_p
2369 || s->extends_to_end_of_line_p 2412 || s->extends_to_end_of_line_p
2370 || force_p) 2413 || force_p)
2371#endif
2372 { 2414 {
2373 x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, 2415 x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
2374 s->background_width, 2416 s->background_width,
@@ -2385,7 +2427,7 @@ static void
2385x_draw_glyph_string_foreground (s) 2427x_draw_glyph_string_foreground (s)
2386 struct glyph_string *s; 2428 struct glyph_string *s;
2387{ 2429{
2388 int i, x; 2430 int i, x, bg_width;
2389 2431
2390 /* If first glyph of S has a left box line, start drawing the text 2432 /* If first glyph of S has a left box line, start drawing the text
2391 of S to the right of that box line. */ 2433 of S to the right of that box line. */
@@ -2424,7 +2466,6 @@ x_draw_glyph_string_foreground (s)
2424 for (i = 0; i < s->nchars; ++i) 2466 for (i = 0; i < s->nchars; ++i)
2425 char1b[i] = s->char2b[i].byte2; 2467 char1b[i] = s->char2b[i].byte2;
2426 2468
2427#if defined (MAC_OS8) && !USE_ATSUI
2428 /* Draw text with XDrawString if background has already been 2469 /* Draw text with XDrawString if background has already been
2429 filled. Otherwise, use XDrawImageString. (Note that 2470 filled. Otherwise, use XDrawImageString. (Note that
2430 XDrawImageString is usually faster than XDrawString.) Always 2471 XDrawImageString is usually faster than XDrawString.) Always
@@ -2432,38 +2473,27 @@ x_draw_glyph_string_foreground (s)
2432 no chance that characters under a box cursor are invisible. */ 2473 no chance that characters under a box cursor are invisible. */
2433 if (s->for_overlaps 2474 if (s->for_overlaps
2434 || (s->background_filled_p && s->hl != DRAW_CURSOR)) 2475 || (s->background_filled_p && s->hl != DRAW_CURSOR))
2435#endif 2476 bg_width = 0; /* Corresponds to XDrawString. */
2436 { 2477 else
2437 /* Draw characters with 16-bit or 8-bit functions. */ 2478 bg_width = s->background_width; /* Corresponds to XDrawImageString. */
2438 if (s->two_byte_p 2479
2480 if (s->two_byte_p
2439#if USE_ATSUI 2481#if USE_ATSUI
2440 || GC_FONT (s->gc)->mac_style 2482 || GC_FONT (s->gc)->mac_style
2441#endif 2483#endif
2442 ) 2484 )
2443#if USE_CG_TEXT_DRAWING 2485#if USE_CG_TEXT_DRAWING
2444 if (!s->two_byte_p 2486 if (!s->two_byte_p
2445 && mac_draw_string_cg (s->f, s->gc, x, s->ybase - boff, 2487 && mac_draw_image_string_cg (s->f, s->gc, x, s->ybase - boff,
2446 s->char2b, s->nchars)) 2488 s->char2b, s->nchars, bg_width))
2447 ; 2489 ;
2448 else 2490 else
2449#endif 2491#endif
2450 mac_draw_string_16 (s->f, s->gc, x, s->ybase - boff, 2492 mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff,
2451 s->char2b, s->nchars); 2493 s->char2b, s->nchars, bg_width);
2452 else
2453 mac_draw_string (s->f, s->gc, x, s->ybase - boff,
2454 char1b, s->nchars);
2455 }
2456#if defined (MAC_OS8) && !USE_ATSUI
2457 else 2494 else
2458 { 2495 mac_draw_image_string (s->f, s->gc, x, s->ybase - boff,
2459 if (s->two_byte_p) 2496 char1b, s->nchars, bg_width);
2460 mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff,
2461 s->char2b, s->nchars);
2462 else
2463 mac_draw_image_string (s->f, s->gc, x, s->ybase - boff,
2464 char1b, s->nchars);
2465 }
2466#endif
2467 } 2497 }
2468} 2498}
2469 2499
@@ -7856,9 +7886,13 @@ XLoadQueryFont (Display *dpy, char *fontname)
7856#if !defined (MAC_OS8) || USE_ATSUI 7886#if !defined (MAC_OS8) || USE_ATSUI
7857 /* AppKit and WebKit do some adjustment to the heights of Courier, 7887 /* AppKit and WebKit do some adjustment to the heights of Courier,
7858 Helvetica, and Times. This only works on the environments where 7888 Helvetica, and Times. This only works on the environments where
7859 the XDrawImageString counterpart is never used. */ 7889 srcCopy text transfer mode is never used. */
7860 if (strcmp (family, "courier") == 0 || strcmp (family, "helvetica") == 0 7890 if (
7861 || strcmp (family, "times") == 0) 7891#ifdef MAC_OS8 /* implies USE_ATSUI */
7892 font->mac_style &&
7893#endif
7894 (strcmp (family, "courier") == 0 || strcmp (family, "helvetica") == 0
7895 || strcmp (family, "times") == 0))
7862 font->ascent += (font->ascent + font->descent) * .15 + 0.5; 7896 font->ascent += (font->ascent + font->descent) * .15 + 0.5;
7863#endif 7897#endif
7864 7898