]> code.delx.au - gnu-emacs/blobdiff - lisp/international/fontset.el
Merged from emacs@sv.gnu.org
[gnu-emacs] / lisp / international / fontset.el
index 863cc99c4db31d51a852f8656d6a95cdb30bacbd..81665ffd1ce2b312c5e83ea17600b3b49ed94e0d 100644 (file)
@@ -1,7 +1,9 @@
 ;;; fontset.el --- commands for handling fontset
 
-;; Copyright (C) 1997, 1998, 1999, 2000, 2001  Free Software Foundation, Inc.
-;; Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007  Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
@@ -21,8 +23,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
             (,(indian-font-char-range 'akruti:guj)
              . (nil . "Gujarati-Akruti"))
             (,(indian-font-char-range 'akruti:ori)
-             . (nil . "Oriay-Akruti"))
+             . (nil . "Oriya-Akruti"))
             (,(indian-font-char-range 'akruti:tml)
              . (nil . "Tamil-Akruti"))
             (,(indian-font-char-range 'akruti:tlg)
        ((if (r2 >= 0)
            ;; This is a 2D charset.
            (r1 = ((r1 << 7) | r2)))
-       (lookup-character ucs-mule-cjk-to-unicode r0 r1)
+       (lookup-character utf-subst-table-for-encode r0 r1)
        (if r7
            ;; We got it!
            ((r1 = (r0 >> 8))
             (r2 = (r0 & #xFF)))
          ;; Look for a translation for non-ASCII chars.
          ((translate-character ucs-mule-to-mule-unicode r0 r1)
-          (if (r0 == ,(charset-id 'latin-iso8859-1))
-              ((r2 = (r1 + 128))
+          (if (r0 == ,(charset-id 'ascii))
+              ((r2 = r1)
                (r1 = 0))
-            ((r2 = (r1 & #x7F))
-             (r1 >>= 7)
-             (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
-                 ((r1 *= 96)
-                  (r1 += r2)
-                  (r1 += ,(- #x100 (* 32 96) 32))
-                  (r1 >8= 0)
-                  (r2 = r7))
-               (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))
-                   ((r1 *= 96)
-                    (r1 += r2)
-                    (r1 += ,(- #x2500 (* 32 96) 32))
-                    (r1 >8= 0)
-                    (r2 = r7))
-                 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))
-                     ((r1 *= 96)
-                      (r1 += r2)
-                      (r1 += ,(- #xe000 (* 32 96) 32))
-                      (r1 >8= 0)
-                      (r2 = r7))
-                   ;; No way, use the glyph for U+FFFD.
-                   ((r1 = #xFF)
-                    (r2 = #xFD)))))))))))))
+            ((if (r0 == ,(charset-id 'latin-iso8859-1))
+                 ((r2 = (r1 + 128))
+                  (r1 = 0))
+               ((r2 = (r1 & #x7F))
+                (r1 >>= 7)
+                (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
+                    ((r1 *= 96)
+                     (r1 += r2)
+                     (r1 += ,(- #x100 (* 32 96) 32))
+                     (r1 >8= 0)
+                     (r2 = r7))
+                  (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))
+                      ((r1 *= 96)
+                       (r1 += r2)
+                       (r1 += ,(- #x2500 (* 32 96) 32))
+                       (r1 >8= 0)
+                       (r2 = r7))
+                    (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))
+                        ((r1 *= 96)
+                         (r1 += r2)
+                         (r1 += ,(- #xe000 (* 32 96) 32))
+                         (r1 >8= 0)
+                         (r2 = r7))
+                      ;; No way, use the glyph for U+FFFD.
+                      ((r1 = #xFF)
+                       (r2 = #xFD)))))))))))))))
   "Encode characters for display with iso10646 font.
 Translate through the translation-hash-table named
 `ucs-mule-cjk-to-unicode' and the translation-table named
@@ -379,10 +384,10 @@ PATTERN.  If no full XLFD name is gotten, return nil."
 
 (defun x-compose-font-name (fields &optional reduce)
   "Compose X's fontname from FIELDS.
-FIELDS is a vector of XLFD fields, the length 14.
+FIELDS is a vector of XLFD fields, of length 14.
 If a field is nil, wild-card letter `*' is embedded.
-Optional argument REDUCE is always ignored.  It exists just for
-backward compatibility."
+Optional argument REDUCE exists just for backward compatibility,
+and is always ignored."
   (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-")))
 
 
@@ -460,7 +465,7 @@ variable `x-font-name-charset-alist'), add that information to FONTLIST."
 (defun fontset-name-p (fontset)
   "Return non-nil if FONTSET is valid as fontset name.
 A valid fontset name should conform to XLFD (X Logical Font Description)
-with \"fontset\" in `<CHARSET_REGISTRY> field."
+with \"fontset\" in `<CHARSET_REGISTRY>' field."
   (and (string-match xlfd-tight-regexp fontset)
        (string= (match-string (1+ xlfd-regexp-registry-subnum) fontset)
                "fontset")))
@@ -515,13 +520,12 @@ with \"fontset\" in `<CHARSET_REGISTRY> field."
                                         &optional style-variant noerror)
   "Create a fontset from fontset specification string FONTSET-SPEC.
 FONTSET-SPEC is a string of the format:
-       FONTSET-NAME,CHARSET-NAME0:FONT-NAME0,CHARSET-NAME1:FONT-NAME1, ...
+       FONTSET-NAME,CHARSET0:FONT0,CHARSET1:FONT1, ...
 Any number of SPACE, TAB, and NEWLINE can be put before and after commas.
 
-Optional 2nd argument is ignored.  It exists just for backward
-compatibility.
+Optional 2nd arg exists just for backward compatibility, and is ignored.
 
-If this function attempts to create already existing fontset, error is
+If this function attempts to create already existing fontset, an error is
 signaled unless the optional 3rd argument NOERROR is non-nil.
 
 It returns a name of the created fontset."
@@ -539,7 +543,8 @@ It returns a name of the created fontset."
          (error "Fontset \"%s\" not conforming to XLFD" name))
 
       ;; At first, extract pairs of charset and fontname from FONTSET-SPEC.
-      (while (string-match "[, \t\n]*\\([^:]+\\):\\([^,]+\\)" fontset-spec idx)
+      (while (string-match "[, \t\n]*\\([^:]+\\):[ \t]*\\([^,]+\\)"
+                          fontset-spec idx)
        (setq idx (match-end 0))
        (setq charset (intern (match-string 1 fontset-spec)))
        (if (charsetp charset)
@@ -574,11 +579,11 @@ It returns a name of the created fontset."
                                            fontset-name)
   "Create a fontset from an ASCII font FONT.
 
-Optional 1st arg RESOLVED-FONT is a resolved name of FONT.  If
-omitted, `x-resolve-font-name' is called to get the resolved name.  At
-this time, if FONT is not available, error is signaled.
+Optional 2nd arg RESOLVED-FONT is a resolved name of FONT.
+If omitted, `x-resolve-font-name' is called to get the resolved name.
+At this time, if FONT is not available, an error is signaled.
 
-Optional 2nd arg FONTSET-NAME is a string to be used in
+Optional 3rd arg FONTSET-NAME is a string to be used in
 `<CHARSET_ENCODING>' fields of a new fontset name.  If it is omitted,
 an appropriate name is generated automatically.