patch Pango to make the system control font accessible

The patch doesn't directly make the font accessible, but
it provides a hook so that the font can be made accessible.
This commit is contained in:
Matthew Flatt 2015-10-04 20:30:17 -06:00
parent 2516374744
commit b92eac82ab
2 changed files with 61 additions and 0 deletions

View File

@ -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

View File

@ -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
*/