diff --git a/racket/src/native-libs/build.rkt b/racket/src/native-libs/build.rkt index 820a2f988f..506ea17b63 100644 --- a/racket/src/native-libs/build.rkt +++ b/racket/src/native-libs/build.rkt @@ -122,6 +122,9 @@ ;; Enable kerning and set DPI to 72: (define-runtime-path coretext-patch "patches/coretext.patch") +;; Support registration of extra font families: +(define-runtime-path coretext-fontreg-patch "patches/coretext-fontreg.patch") + ;; Enable "symbol" fonts, and fix off-by-one: (define-runtime-path win32text-patch "patches/win32text.patch") @@ -433,6 +436,7 @@ '("--with-included-modules=yes" "--with-dynamic-modules=no")) #:patches (list coretext-patch + coretext-fontreg-patch win32text-patch))] [("gmp") (config #:patches (if gcc-4.0? (list gmp-weak-patch) null) #:configure (append diff --git a/racket/src/native-libs/patches/coretext-fontreg.patch b/racket/src/native-libs/patches/coretext-fontreg.patch new file mode 100644 index 0000000000..273166a1df --- /dev/null +++ b/racket/src/native-libs/patches/coretext-fontreg.patch @@ -0,0 +1,57 @@ +diff -u -r old/pango-1.36.6/pango/pangocoretext-fontmap.c new/pango-1.36.6/pango/pangocoretext-fontmap.c +--- old/pango-1.36.6/pango/pangocoretext-fontmap.c 2015-10-04 20:27:08.000000000 -0600 ++++ new/pango-1.36.6/pango/pangocoretext-fontmap.c 2015-10-04 20:25:23.000000000 -0600 +@@ -548,6 +548,53 @@ + pfclass->is_synthesized = pango_core_text_face_is_synthesized; + } + ++void pango_core_text_add_family_for_font_descriptors(PangoCoreTextFontMap *ctfontmap, ++ char *name, ++ int count, ++ CTFontDescriptorRef *descs) ++{ ++ PangoCoreTextFamily *family; ++ PangoCoreTextFace *face; ++ int i; ++ char *fold_name; ++ ++ fold_name = g_utf8_casefold (name, -1); ++ ++ if (g_hash_table_lookup (ctfontmap->families, fold_name)) { ++ g_free(fold_name); ++ return; ++ } ++ ++ family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL); ++ family->family_name = g_strdup(name); ++ { ++ CFDictionaryRef dict; ++ CFNumberRef number; ++ SInt64 font_traits; ++ ++ dict = CTFontDescriptorCopyAttribute (descs[0], kCTFontTraitsAttribute); ++ number = (CFNumberRef)CFDictionaryGetValue (dict, ++ kCTFontSymbolicTrait); ++ ++ if (CFNumberGetValue (number, kCFNumberSInt64Type, &font_traits)) ++ { ++ if ((font_traits & kCTFontMonoSpaceTrait) == kCTFontMonoSpaceTrait) ++ family->is_monospace = TRUE; ++ } ++ } ++ g_hash_table_insert (ctfontmap->families, fold_name, family); ++ ++ family->n_faces = count; ++ family->faces = g_new (PangoFontFace *, family->n_faces); ++ ++ for (i = 0; i < count; i++) { ++ face = pango_core_text_face_from_ct_font_descriptor (descs[i]); ++ face->family = family; ++ ++ family->faces[i] = (PangoFontFace *)face; ++ } ++} ++ + /* + * PangoCoreTextFamily + */