emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Mac port


From: YAMAMOTO Mitsuharu
Subject: Re: Emacs Mac port
Date: Fri, 27 Jul 2012 06:50:22 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Thu, 26 Jul 2012 18:45:11 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

> The first update of Emacs 24 Mac port 3.x is available from

>     ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-24.1-mac-3.1.tar.gz

> The second update of Emacs 23 Mac port 2.x is also available from

>     ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-23.4-mac-2.2.tar.gz

I found that the preferred font family selection mechanism in the
mac-ct font backend driver did not work on OS X 10.8 Mountain Lion.
Please apply the patch below.  This is not required for 10.7 and
earlier, though it also works on these versions.

                                     YAMAMOTO Mitsuharu
                                address@hidden

=== modified file 'src/macfont.c'
*** src/macfont.c       2012-04-28 03:42:42 +0000
--- src/macfont.c       2012-07-26 21:39:20 +0000
***************
*** 2814,2840 ****
    if (charset_string
        && (length = CFStringGetLength (charset_string)) > 0)
      {
!       CTFontRef last_resort =
!       CTFontCreateWithName (CFSTR ("LastResort"), 0, NULL);
  
!       if (last_resort)
        {
!         CTFontRef font = CTFontCreateForString (last_resort, charset_string,
!                                                 CFRangeMake (0, length));
  
!         if (font)
            {
!             result = CTFontCopyAttribute (font, kCTFontFamilyNameAttribute);
! 
!             if (CFStringCompare (result, CFSTR ("LastResort"), 0)
!                 == kCFCompareEqualTo)
!               {
!                 CFRelease (result);
!                 result = NULL;
!               }
!             CFRelease (font);
            }
!         CFRelease (last_resort);
        }
      }
  
--- 2814,2862 ----
    if (charset_string
        && (length = CFStringGetLength (charset_string)) > 0)
      {
!       CFAttributedStringRef attr_string = NULL;
!       CTLineRef ctline = NULL;
!       CFDictionaryRef attrs =
!       CFDictionaryCreate (NULL, NULL, NULL, 0,
!                           &kCFTypeDictionaryKeyCallBacks,
!                           &kCFTypeDictionaryValueCallBacks);
  
!       if (attrs)
        {
!         attr_string = CFAttributedStringCreate (NULL, charset_string, attrs);
!         CFRelease (attrs);
!       }
!       if (attr_string)
!       {
!         ctline = CTLineCreateWithAttributedString (attr_string);
!         CFRelease (attr_string);
!       }
!       if (ctline)
!       {
!         CFArrayRef runs = CTLineGetGlyphRuns (ctline);
!         CFIndex i, nruns = CFArrayGetCount (runs);
!         CTFontRef font;
  
!         for (i = 0; i < nruns; i++)
            {
!             CTRunRef run = CFArrayGetValueAtIndex (runs, i);
!             CFDictionaryRef attributes = CTRunGetAttributes (run);
!             CTFontRef font_in_run;
! 
!             if (attributes == NULL)
!               break;
!             font_in_run =
!               CFDictionaryGetValue (attributes, kCTFontAttributeName);
!             if (font_in_run == NULL)
!               break;
!             if (i == 0)
!               font = font_in_run;
!             else if (!mac_ctfont_equal_in_postscript_name (font, font_in_run))
!               break;
            }
!         if (nruns > 0 && i == nruns)
!           result = CTFontCopyAttribute (font, kCTFontFamilyNameAttribute);
!         CFRelease (ctline);
        }
      }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]