Commit 9a265587 authored by Jan Djärv's avatar Jan Djärv

Require OSX >= 10.6. Remove PowerPC unexec code.

* configure.ac: Require OSX 10.6.  Remove NSInteger test,
use nsfont for Gnustep, macfont for OSX.

* etc/NEWS: OSX required is 10.6 or newer.

* src/Makefile.in: Replace nsfont.o macfont.o with ns_fontfile in
comment.

* src/macfont.h (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_FORMAT_BITMAP)
(mac_font_copy_non_synthetic_table): Remove versions for OSX < 10.6

* src/nsfns.m: Always include src/macfont.h on COCOA.
(ns_filename_from_panel, ns_directory_from_panel)
(Fx_create_frame, Fns_popup_font_panel, ns_run_file_dialog)
(Fns_read_file_name, Fns_list_services): Remove code for OSX < 10.6

* src/nsterm.m: Always include src/macfont.h on COCOA.
(ns_update_auto_hide_menu_bar, ns_draw_fringe_bitmap)
(ns_dumpglyphs_image, ns_check_menu_open)
(applicationDidFinishLaunching)
(antialiasThresholdDidChange:)
(keyDown:, toggleFullScreen:, setPosition:portion:whole:): Remove
checks for OSX <= 10.5/10.6.
(changeFont:): Use macfont on COCOA, nsfont on GNUSTEP.
(syms_of_nsterm): Call syms_of_macfont on COCOA, syms_of_nsfont on
GNUSTEP.

* src/macfont.m: Remove >= 1050 check.
(macfont_create_family_with_symbol)
(macfont_get_glyph_for_character)
(mac_font_get_glyphs_for_variants)
(mac_ctfont_create_available_families, syms_of_macfont): Remove
code for OSX < 10.6.
(mac_font_family_group, mac_font_family_compare): Remove, only used
for OSX < 10.6.

* src/nsimage.m (allocInitFromFile:): Remove code for OSX < 10.6.

* src/nsmenu.m (NSMenuDidBeginTrackingNotification): Remove.
(x_activate_menubar, trackingNotification:): Remove check for
OSX >= 10.5.
(menuNeedsUpdate:): Remove check for OSX < 10.5.

* src/nsterm.h (MAC_OS_X_VERSION_10_4, MAC_OS_X_VERSION_10_5): Remove.
(NS_HAVE_NSINTEGER): Remove block.
Remove >= OSX 10.6 tests.

* src/unexmacosx.c: Remove include ppc/reloc.h.
(unrelocate, copy_dysymtab): Remove PPC code.
(rebase_reloc_address): Remove, only used for PPC:
parent 4c4c5b91
2014-10-12 Jan Djärv <jan.h.d@swipnet.se>
* configure.ac: Require OSX 10.6. Remove NSInteger test,
use nsfont for Gnustep, macfont for OSX.
2014-10-12 Paul Eggert <eggert@cs.ucla.edu> 2014-10-12 Paul Eggert <eggert@cs.ucla.edu>
Fix putenv race conditions that can crash Emacs (Bug#8705). Fix putenv race conditions that can crash Emacs (Bug#8705).
......
...@@ -1717,12 +1717,14 @@ if test "${with_ns}" != no; then ...@@ -1717,12 +1717,14 @@ if test "${with_ns}" != no; then
ns_appbindir=${ns_appdir}/Contents/MacOS ns_appbindir=${ns_appdir}/Contents/MacOS
ns_appresdir=${ns_appdir}/Contents/Resources ns_appresdir=${ns_appdir}/Contents/Resources
ns_appsrc=Cocoa/Emacs.base ns_appsrc=Cocoa/Emacs.base
ns_fontfile=macfont.o
elif test -f $GNUSTEP_CONFIG_FILE; then elif test -f $GNUSTEP_CONFIG_FILE; then
NS_IMPL_GNUSTEP=yes NS_IMPL_GNUSTEP=yes
ns_appdir=`pwd`/nextstep/Emacs.app ns_appdir=`pwd`/nextstep/Emacs.app
ns_appbindir=${ns_appdir} ns_appbindir=${ns_appdir}
ns_appresdir=${ns_appdir}/Resources ns_appresdir=${ns_appdir}/Resources
ns_appsrc=GNUstep/Emacs.base ns_appsrc=GNUstep/Emacs.base
ns_fontfile=nsfont.o
dnl FIXME sourcing this several times in subshells seems inefficient. dnl FIXME sourcing this several times in subshells seems inefficient.
GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)" GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)" GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
...@@ -1765,48 +1767,24 @@ fail; ...@@ -1765,48 +1767,24 @@ fail;
macfont_file="" macfont_file=""
if test "${NS_IMPL_COCOA}" = "yes"; then if test "${NS_IMPL_COCOA}" = "yes"; then
AC_MSG_CHECKING([for OSX 10.4 or newer]) AC_MSG_CHECKING([for OSX 10.6 or newer])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
[ [
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED #ifdef MAC_OS_X_VERSION_MAX_ALLOWED
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
; /* OK */ ; /* OK */
#else #else
error "OSX 10.4 or newer required"; error "OSX 10.6 or newer required";
#endif #endif
#endif #endif
])], ])],
ns_osx_have_104=yes, ns_osx_have_106=yes,
ns_osx_have_104=no) ns_osx_have_106=no)
AC_MSG_RESULT([$ns_osx_have_104]) AC_MSG_RESULT([$ns_osx_have_106])
if test $ns_osx_have_104 = no; then if test $ns_osx_have_106 = no; then
AC_MSG_ERROR([`OSX 10.4 or newer is required']); AC_MSG_ERROR([`OSX 10.6 or newer is required']);
fi fi
AC_MSG_CHECKING([for OSX 10.5 or newer])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
[
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
; /* OK */
#else
error "OSX 10.5 not found";
#endif
#endif
])],
ns_osx_have_105=yes,
ns_osx_have_105=no)
AC_MSG_RESULT([$ns_osx_have_105])
if test $ns_osx_have_105 = yes; then
macfont_file="macfont.o"
fi
fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Foundation/NSObjCRuntime.h>],
[NSInteger i;])],
ns_have_nsinteger=yes,
ns_have_nsinteger=no)
if test $ns_have_nsinteger = yes; then
AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.])
fi fi
fi fi
...@@ -1840,7 +1818,7 @@ if test "${HAVE_NS}" = yes; then ...@@ -1840,7 +1818,7 @@ if test "${HAVE_NS}" = yes; then
INSTALL_ARCH_INDEP_EXTRA= INSTALL_ARCH_INDEP_EXTRA=
fi fi
NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o $macfont_file" NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o $ns_fontfile"
fi fi
CFLAGS="$tmp_CFLAGS" CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS" CPPFLAGS="$tmp_CPPFLAGS"
......
2014-10-12 Jan Djärv <jan.h.d@swipnet.se>
* NEWS: OSX required is 10.6 or newer.
2014-10-09 Leo Liu <sdl.web@gmail.com> 2014-10-09 Leo Liu <sdl.web@gmail.com>
* NEWS: Mention optional arg to terpri and new cl-lib functions. * NEWS: Mention optional arg to terpri and new cl-lib functions.
......
...@@ -36,6 +36,9 @@ should be able to work around the problem either by porting the Emacs ...@@ -36,6 +36,9 @@ should be able to work around the problem either by porting the Emacs
undumping code to GCC under IRIX, or by configuring --with-wide-int, undumping code to GCC under IRIX, or by configuring --with-wide-int,
or by sticking with Emacs 24.4. or by sticking with Emacs 24.4.
** Building Emacs on OSX now requires 10.6 or newer.
That also means that PowerPC is not supported.
--- ---
** The configure option `--with-pkg-config-prog' has been removed. ** The configure option `--with-pkg-config-prog' has been removed.
Use './configure PKG_CONFIG=/full/name/of/pkg-config' if you need to. Use './configure PKG_CONFIG=/full/name/of/pkg-config' if you need to.
......
2014-10-12 Jan Djärv <jan.h.d@swipnet.se>
* unexmacosx.c: Remove include ppc/reloc.h.
(unrelocate, copy_dysymtab): Remove PPC code.
(rebase_reloc_address): Remove, only used for PPC:
* nsterm.m: Always include macfont.h on COCOA.
(ns_update_auto_hide_menu_bar, ns_draw_fringe_bitmap)
(ns_dumpglyphs_image, ns_check_menu_open)
(applicationDidFinishLaunching)
(antialiasThresholdDidChange:)
(keyDown:, toggleFullScreen:, setPosition:portion:whole:): Remove
checks for OSX <= 10.5/10.6.
(changeFont:): Use macfont on COCOA, nsfont on GNUSTEP.
(syms_of_nsterm): Call syms_of_macfont on COCOA, syms_of_nsfont on
GNUSTEP.
* nsterm.h (MAC_OS_X_VERSION_10_4, MAC_OS_X_VERSION_10_5): Remove.
(NS_HAVE_NSINTEGER): Remove block.
Remove >= OSX 10.6 tests.
* nsmenu.m (NSMenuDidBeginTrackingNotification): Remove.
(x_activate_menubar, trackingNotification:): Remove check for
OSX >= 10.5.
(menuNeedsUpdate:): Remove check for OSX < 10.5.
* nsimage.m (allocInitFromFile:): Remove code for OSX < 10.6.
* nsfns.m: Always include macfont.h on COCOA.
(ns_filename_from_panel, ns_directory_from_panel)
(Fx_create_frame, Fns_popup_font_panel, ns_run_file_dialog)
(Fns_read_file_name, Fns_list_services): Remove code for OSX < 10.6
* macfont.m: Remove >= 1050 check.
(macfont_create_family_with_symbol)
(macfont_get_glyph_for_character)
(mac_font_get_glyphs_for_variants)
(mac_ctfont_create_available_families, syms_of_macfont): Remove
code for OSX < 10.6.
(mac_font_family_group, mac_font_family_compare): Remove, only used
for OSX < 10.6.
* macfont.h (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_FORMAT_BITMAP)
(mac_font_copy_non_synthetic_table): Remove versions for OSX < 10.6
* Makefile.in: Replace nsfont.o macfont.o with ns_fontfile in
comment.
2014-10-12 Paul Eggert <eggert@cs.ucla.edu> 2014-10-12 Paul Eggert <eggert@cs.ucla.edu>
Fix putenv race conditions with undefined behavior (Bug#8705). Fix putenv race conditions with undefined behavior (Bug#8705).
......
...@@ -250,7 +250,7 @@ MSDOS_OBJ = ...@@ -250,7 +250,7 @@ MSDOS_OBJ =
MSDOS_X_OBJ = MSDOS_X_OBJ =
NS_OBJ=@NS_OBJ@ NS_OBJ=@NS_OBJ@
## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macfont.o if HAVE_NS. ## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o ns_fontfile if HAVE_NS.
NS_OBJC_OBJ=@NS_OBJC_OBJ@ NS_OBJC_OBJ=@NS_OBJC_OBJ@
## Only set if NS_IMPL_GNUSTEP. ## Only set if NS_IMPL_GNUSTEP.
GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@ GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@
......
...@@ -57,11 +57,7 @@ typedef CTCharacterCollection CharacterCollection; ...@@ -57,11 +57,7 @@ typedef CTCharacterCollection CharacterCollection;
#define MAC_FONT_CASCADE_LIST_ATTRIBUTE kCTFontCascadeListAttribute #define MAC_FONT_CASCADE_LIST_ATTRIBUTE kCTFontCascadeListAttribute
#define MAC_FONT_CHARACTER_SET_ATTRIBUTE kCTFontCharacterSetAttribute #define MAC_FONT_CHARACTER_SET_ATTRIBUTE kCTFontCharacterSetAttribute
#define MAC_FONT_LANGUAGES_ATTRIBUTE kCTFontLanguagesAttribute #define MAC_FONT_LANGUAGES_ATTRIBUTE kCTFontLanguagesAttribute
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
#define MAC_FONT_FORMAT_ATTRIBUTE kCTFontFormatAttribute #define MAC_FONT_FORMAT_ATTRIBUTE kCTFontFormatAttribute
#else
#define MAC_FONT_FORMAT_ATTRIBUTE (CFSTR ("NSCTFontFormatAttribute"))
#endif
#define MAC_FONT_SYMBOLIC_TRAIT kCTFontSymbolicTrait #define MAC_FONT_SYMBOLIC_TRAIT kCTFontSymbolicTrait
#define MAC_FONT_WEIGHT_TRAIT kCTFontWeightTrait #define MAC_FONT_WEIGHT_TRAIT kCTFontWeightTrait
#define MAC_FONT_WIDTH_TRAIT kCTFontWidthTrait #define MAC_FONT_WIDTH_TRAIT kCTFontWidthTrait
...@@ -79,11 +75,7 @@ enum { ...@@ -79,11 +75,7 @@ enum {
}; };
enum { enum {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
MAC_FONT_FORMAT_BITMAP = kCTFontFormatBitmap MAC_FONT_FORMAT_BITMAP = kCTFontFormatBitmap
#else
MAC_FONT_FORMAT_BITMAP = 5
#endif
}; };
enum { enum {
...@@ -112,13 +104,8 @@ enum { ...@@ -112,13 +104,8 @@ enum {
#define mac_font_get_underline_position CTFontGetUnderlinePosition #define mac_font_get_underline_position CTFontGetUnderlinePosition
#define mac_font_get_underline_thickness CTFontGetUnderlineThickness #define mac_font_get_underline_thickness CTFontGetUnderlineThickness
#define mac_font_copy_graphics_font(font) CTFontCopyGraphicsFont (font, NULL) #define mac_font_copy_graphics_font(font) CTFontCopyGraphicsFont (font, NULL)
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
#define mac_font_copy_non_synthetic_table(font, table) \ #define mac_font_copy_non_synthetic_table(font, table) \
CTFontCopyTable (font, table, kCTFontTableOptionNoOptions) CTFontCopyTable (font, table, kCTFontTableOptionNoOptions)
#else
#define mac_font_copy_non_synthetic_table(font, table) \
CTFontCopyTable (font, table, kCTFontTableOptionExcludeSynthetic)
#endif
#define mac_font_create_preferred_family_for_attributes \ #define mac_font_create_preferred_family_for_attributes \
mac_ctfont_create_preferred_family_for_attributes mac_ctfont_create_preferred_family_for_attributes
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include "macfont.h" #include "macfont.h"
#include "macuvs.h" #include "macuvs.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
#include <libkern/OSByteOrder.h> #include <libkern/OSByteOrder.h>
static struct font_driver macfont_driver; static struct font_driver macfont_driver;
...@@ -926,22 +924,9 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char, ...@@ -926,22 +924,9 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char,
if (family_name == NULL) if (family_name == NULL)
return NULL; return NULL;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (CTFontManagerCompareFontFamilyNames != NULL)
#endif
{ {
family_name_comparator = CTFontManagerCompareFontFamilyNames; family_name_comparator = CTFontManagerCompareFontFamilyNames;
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
else /* CTFontManagerCompareFontFamilyNames == NULL */
#endif
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 */
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
{
family_name_comparator = mac_font_family_compare;
}
#endif
if ((*family_name_comparator) (family_name, CFSTR ("LastResort"), NULL) if ((*family_name_comparator) (family_name, CFSTR ("LastResort"), NULL)
== kCFCompareEqualTo) == kCFCompareEqualTo)
...@@ -1331,12 +1316,8 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, ...@@ -1331,12 +1316,8 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
CGGlyph *glyphs; CGGlyph *glyphs;
int i, len; int i, len;
int nrows; int nrows;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
dispatch_queue_t queue; dispatch_queue_t queue;
dispatch_group_t group = NULL; dispatch_group_t group = NULL;
#else
int nkeys;
#endif
if (row != 0) if (row != 0)
{ {
...@@ -1374,14 +1355,12 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, ...@@ -1374,14 +1355,12 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
return glyph; return glyph;
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
queue = queue =
dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
group = dispatch_group_create (); group = dispatch_group_create ();
dispatch_group_async (group, queue, ^{ dispatch_group_async (group, queue, ^{
int nkeys; int nkeys;
uintptr_t key; uintptr_t key;
#endif
nkeys = nkeys_or_perm; nkeys = nkeys_or_perm;
for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++) for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++)
if (CFDictionaryContainsKey (dictionary, if (CFDictionaryContainsKey (dictionary,
...@@ -1392,9 +1371,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, ...@@ -1392,9 +1371,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
if (--nkeys == 0) if (--nkeys == 0)
break; break;
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
}); });
#endif
} }
len = 0; len = 0;
...@@ -1436,13 +1413,11 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, ...@@ -1436,13 +1413,11 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font,
cache->glyph.matrix[nrows - 1] = glyphs; cache->glyph.matrix[nrows - 1] = glyphs;
cache->glyph.nrows = nrows; cache->glyph.nrows = nrows;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
if (group) if (group)
{ {
dispatch_group_wait (group, DISPATCH_TIME_FOREVER); dispatch_group_wait (group, DISPATCH_TIME_FOREVER);
dispatch_release (group); dispatch_release (group);
} }
#endif
} }
return cache->glyph.matrix[nkeys_or_perm - ROW_PERM_OFFSET][c % 256]; return cache->glyph.matrix[nkeys_or_perm - ROW_PERM_OFFSET][c % 256];
...@@ -3165,11 +3140,9 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -3165,11 +3140,9 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
struct variation_selector_record *records = uvs->variation_selector_records; struct variation_selector_record *records = uvs->variation_selector_records;
CFIndex i; CFIndex i;
UInt32 ir, nrecords; UInt32 ir, nrecords;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
dispatch_queue_t queue = dispatch_queue_t queue =
dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_group_t group = dispatch_group_create (); dispatch_group_t group = dispatch_group_create ();
#endif
nrecords = BUINT32_VALUE (uvs->num_var_selector_records); nrecords = BUINT32_VALUE (uvs->num_var_selector_records);
i = 0; i = 0;
...@@ -3193,9 +3166,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -3193,9 +3166,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
default_uvs_offset = BUINT32_VALUE (records[ir].default_uvs_offset); default_uvs_offset = BUINT32_VALUE (records[ir].default_uvs_offset);
non_default_uvs_offset = non_default_uvs_offset =
BUINT32_VALUE (records[ir].non_default_uvs_offset); BUINT32_VALUE (records[ir].non_default_uvs_offset);
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
dispatch_group_async (group, queue, ^{ dispatch_group_async (group, queue, ^{
#endif
glyphs[i] = kCGFontIndexInvalid; glyphs[i] = kCGFontIndexInvalid;
if (default_uvs_offset) if (default_uvs_offset)
...@@ -3247,18 +3218,14 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -3247,18 +3218,14 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
BUINT24_VALUE (mappings[hi - 1].unicode_value) == c) BUINT24_VALUE (mappings[hi - 1].unicode_value) == c)
glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id); glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id);
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
}); });
#endif
i++; i++;
ir++; ir++;
} }
while (i < count) while (i < count)
glyphs[i++] = kCGFontIndexInvalid; glyphs[i++] = kCGFontIndexInvalid;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
dispatch_group_wait (group, DISPATCH_TIME_FOREVER); dispatch_group_wait (group, DISPATCH_TIME_FOREVER);
dispatch_release (group); dispatch_release (group);
#endif
} }
static int static int
...@@ -3460,10 +3427,6 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -3460,10 +3427,6 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
{ {
CFMutableArrayRef families = NULL; CFMutableArrayRef families = NULL;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (CTFontManagerCopyAvailableFontFamilyNames != NULL)
#endif
{ {
CFArrayRef orig_families = CTFontManagerCopyAvailableFontFamilyNames (); CFArrayRef orig_families = CTFontManagerCopyAvailableFontFamilyNames ();
...@@ -3487,56 +3450,8 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -3487,56 +3450,8 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
CFRelease (orig_families); CFRelease (orig_families);
} }
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
else /* CTFontManagerCopyAvailableFontFamilyNames == NULL */
#endif
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 */
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
{
CTFontCollectionRef collection;
CFArrayRef descs = NULL;
collection = CTFontCollectionCreateFromAvailableFonts (NULL); return families;
if (collection)
{
descs = CTFontCollectionCreateMatchingFontDescriptors (collection);
CFRelease (collection);
}
if (descs)
{
CFIndex i, count = CFArrayGetCount (descs);
families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks);
if (families)
for (i = 0; i < count; i++)
{
FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, i);
CFStringRef name =
mac_font_descriptor_copy_attribute (desc,
MAC_FONT_FAMILY_NAME_ATTRIBUTE);
if (name)
{
CFIndex p, limit = CFArrayGetCount (families);
p = CFArrayBSearchValues (families, CFRangeMake (0, limit),
(const void *) name,
mac_font_family_compare, NULL);
if (p >= limit)
CFArrayAppendValue (families, name);
else if (mac_font_family_compare
(CFArrayGetValueAtIndex (families, p),
name, NULL) != kCFCompareEqualTo)
CFArrayInsertValueAtIndex (families, p, name);
CFRelease (name);
}
}
CFRelease (descs);
}
}
#endif
return families;
} }
static Boolean static Boolean
...@@ -3855,41 +3770,6 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -3855,41 +3770,6 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
} }
#endif #endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
static inline int
mac_font_family_group (CFStringRef family)
{
if (CFStringHasPrefix (family, CFSTR ("#")))
return 2;
else
{
CFRange range;
range = CFStringFind (family, CFSTR ("Apple"),
kCFCompareCaseInsensitive | kCFCompareAnchored);
if (range.location != kCFNotFound)
return 1;
return 0;
}
}
static CFComparisonResult
mac_font_family_compare (const void *val1, const void *val2, void *context)
{
CFStringRef family1 = (CFStringRef) val1, family2 = (CFStringRef) val2;
int group1, group2;
group1 = mac_font_family_group (family1);
group2 = mac_font_family_group (family2);
if (group1 < group2)
return kCFCompareLessThan;
if (group1 > group2)
return kCFCompareGreaterThan;
return CFStringCompare (family1, family2, kCFCompareCaseInsensitive);
}
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
static CFArrayRef static CFArrayRef
mac_font_copy_default_descriptors_for_language (CFStringRef language) mac_font_copy_default_descriptors_for_language (CFStringRef language)
{ {
...@@ -4040,13 +3920,10 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -4040,13 +3920,10 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
register_font_driver (&macfont_driver, f); register_font_driver (&macfont_driver, f);
} }
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
void void
syms_of_macfont (void) syms_of_macfont (void)
{ {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
static struct font_driver mac_font_driver; static struct font_driver mac_font_driver;
DEFSYM (Qmac_ct, "mac-ct"); DEFSYM (Qmac_ct, "mac-ct");
...@@ -4055,5 +3932,4 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no ...@@ -4055,5 +3932,4 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
DEFSYM (QCdestination, ":destination"); DEFSYM (QCdestination, ":destination");
DEFSYM (QCminspace, ":minspace"); DEFSYM (QCminspace, ":minspace");
#endif
} }
...@@ -46,10 +46,8 @@ Updated by Christian Limpach (chris@nice.ch) ...@@ -46,10 +46,8 @@ Updated by Christian Limpach (chris@nice.ch)
#ifdef NS_IMPL_COCOA #ifdef NS_IMPL_COCOA
#include <IOKit/graphics/IOGraphicsLib.h> #include <IOKit/graphics/IOGraphicsLib.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#include "macfont.h" #include "macfont.h"
#endif #endif
#endif
#if 0 #if 0
int fns_trace_num = 1; int fns_trace_num = 1;
...@@ -197,7 +195,7 @@ Updated by Christian Limpach (chris@nice.ch) ...@@ -197,7 +195,7 @@ Updated by Christian Limpach (chris@nice.ch)
static NSString * static NSString *
ns_filename_from_panel (NSSavePanel *panel) ns_filename_from_panel (NSSavePanel *panel)
{ {
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #ifdef NS_IMPL_COCOA
NSURL *url = [panel URL]; NSURL *url = [panel URL];
NSString *str = [url path]; NSString *str = [url path];
return str; return str;
...@@ -209,7 +207,7 @@ Updated by Christian Limpach (chris@nice.ch) ...@@ -209,7 +207,7 @@ Updated by Christian Limpach (chris@nice.ch)
static NSString * <