changeset 67000:e99c1fd37bcd

[USE_CG_TEXT_DRAWING] (cg_text_anti_aliasing_threshold): New variable. [USE_CG_TEXT_DRAWING] (init_cg_text_anti_aliasing_threshold): New function. (init_font_name_table) [USE_ATSUI && USE_CG_TEXT_DRAWING]: Use it. [USE_CG_TEXT_DRAWING] (mac_draw_string_cg): Don't do antialiasing if font size is smaller than or equal to cg_text_anti_aliasing_threshold.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sat, 19 Nov 2005 06:35:19 +0000
parents 1dd15c8aa21e
children 72f96bbba39a
files src/macterm.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/macterm.c	Sat Nov 19 06:34:23 2005 +0000
+++ b/src/macterm.c	Sat Nov 19 06:35:19 2005 +0000
@@ -867,6 +867,19 @@
 #if USE_CG_TEXT_DRAWING
 static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *));
 
+static int cg_text_anti_aliasing_threshold = 8;
+
+static void
+init_cg_text_anti_aliasing_threshold ()
+{
+  Lisp_Object val =
+    Fmac_get_preference (build_string ("AppleAntiAliasingThreshold"),
+			 Qnil, Qnil, Qnil);
+
+  if (INTEGERP (val))
+    cg_text_anti_aliasing_threshold = XINT (val);
+}
+
 static int
 mac_draw_string_cg (f, gc, x, y, buf, nchars)
      struct frame *f;
@@ -915,6 +928,8 @@
 			    1.0);
   CGContextSetFont (context, GC_FONT (gc)->cg_font);
   CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize);
+  if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold)
+    CGContextSetShouldAntialias (context, false);
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
   CGContextSetTextPosition (context, gx, gy);
   CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
@@ -6784,6 +6799,9 @@
   text_encoding_info_alist = create_text_encoding_info_alist ();
 
 #if USE_ATSUI
+#if USE_CG_TEXT_DRAWING
+  init_cg_text_anti_aliasing_threshold ();
+#endif
   if (!NILP (assq_no_quit (make_number (kTextEncodingMacUnicode),
 			   text_encoding_info_alist)))
     {