[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src nsfont.m
From: |
Adrian Robert |
Subject: |
[Emacs-diffs] emacs/src nsfont.m |
Date: |
Wed, 23 Sep 2009 02:36:57 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Adrian Robert <arobert> 09/09/23 02:36:57
Modified files:
src : nsfont.m
Log message:
* nsfont.m (Vns_reg_to_script): New lisp variable.
(syms_of_nsfont): Declare it.
(ns_registry_to_script): New function.
(ns_get_req_script): Call it.
(ns_findfonts): Don't give up on non-unicode registry.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsfont.m?cvsroot=emacs&r1=1.36&r2=1.37
Patches:
Index: nsfont.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsfont.m,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- nsfont.m 18 Sep 2009 15:12:34 -0000 1.36
+++ nsfont.m 23 Sep 2009 02:36:57 -0000 1.37
@@ -46,6 +46,7 @@
extern Lisp_Object Qns;
extern Lisp_Object Qnormal, Qbold, Qitalic, Qcondensed, Qexpanded;
+static Lisp_Object Vns_reg_to_script;
static Lisp_Object Qapple, Qroman, Qmedium;
extern Lisp_Object Qappend;
extern int ns_antialias_text;
@@ -301,17 +302,35 @@
}
-/* Searches the :script, :lang, and :otf extra-bundle properties of the spec
- for something that can be mapped to a unicode script. Empty string returned
- if no script spec found.
- TODO: Eventually registry / encoding should be checked and mapped, but for
- now the font backend will try script/lang/otf if registry fails, so it is
- not needed. */
+/* Convert a font registry, such as */
+static NSString
+*ns_registry_to_script (char *reg)
+{
+ Lisp_Object script, r, rts = Vns_reg_to_script;
+ while CONSP (rts)
+ {
+ r = XCAR (XCAR (rts));
+ if (!strncmp(SDATA(r), reg, strlen(SDATA(r))))
+ {
+ script = XCDR (XCAR (rts));
+ return [NSString stringWithUTF8String: SDATA (SYMBOL_NAME
(script))];
+ }
+ rts = XCDR (rts);
+ }
+ return @"";
+}
+
+
+/* Searches the :script, :lang, and :otf extra-bundle properties of the spec,
+ plus registry regular property, for something that can be mapped to a
+ unicode script. Empty string returned if no script spec found. */
static NSString
*ns_get_req_script (Lisp_Object font_spec)
{
+ Lisp_Object reg = AREF (font_spec, FONT_REGISTRY_INDEX);
Lisp_Object extra = AREF (font_spec, FONT_EXTRA_INDEX);
+ /* The extra-bundle properties have priority. */
for ( ; CONSP (extra); extra = XCDR (extra))
{
Lisp_Object tmp = XCAR (extra);
@@ -327,6 +346,20 @@
return ns_otf_to_script (val);
}
}
+
+ /* If we get here, check the charset portion of the registry. */
+ if (! NILP (reg))
+ {
+ /* XXX: iso10646 is passed in for non-ascii latin-1 characters
+ (which causes box rendering if we don't treat it like iso8858-1)
+ but also for ascii (which causes unnecessary font substitution). */
+#if 0
+ if (EQ (reg, Qiso10646_1))
+ reg = Qiso8859_1;
+#endif
+ return ns_registry_to_script (SDATA (SYMBOL_NAME (reg)));
+ }
+
return @"";
}
@@ -466,11 +499,6 @@
debug_print (font_spec);
}
- /* If has non-unicode registry, give up. */
- tem = AREF (font_spec, FONT_REGISTRY_INDEX);
- if (! NILP (tem) && !EQ (tem, Qiso10646_1) && !EQ (tem, Qunicode_bmp))
- return isMatch ? ns_fallback_entity () : Qnil;
-
cFamilies = ns_get_covering_families (ns_get_req_script (font_spec), 0.90);
fdesc = ns_spec_to_descriptor (font_spec);
@@ -1490,6 +1518,8 @@
DEFSYM (Qapple, "apple");
DEFSYM (Qroman, "roman");
DEFSYM (Qmedium, "medium");
+ DEFVAR_LISP ("ns-reg-to-script", &Vns_reg_to_script,
+ doc: /* Internal use: maps font registry to unicode script. */);
}
// arch-tag: d6c3c6f0-62de-4978-8b1e-b7966fe02cae