]> code.delx.au - gnu-emacs/blobdiff - lisp/language/hebrew.el
Add a new function `svg-embed'
[gnu-emacs] / lisp / language / hebrew.el
index 58ffb02982f3f9f699db2fcb176c7f6630721473..ae8cc95c9683fb3bb15d6321e613041c0793bd2d 100644 (file)
@@ -1,7 +1,6 @@
 ;;; hebrew.el --- support for Hebrew -*- coding: utf-8 -*-
 
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 2001-2016 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -217,24 +216,26 @@ Bidirectional editing is supported.")))
          (setq idx 1 nglyphs nchars))
        ;; Now IDX is an index to the first non-precomposed glyph.
        ;; Adjust positions of the remaining glyphs artificially.
-       (setq base-width (lglyph-width (lgstring-glyph gstring 0)))
-       (while (< idx nglyphs)
-         (setq glyph (lgstring-glyph gstring idx))
-         (lglyph-set-from-to glyph 0 (1- nchars))
-         (if (>= (lglyph-lbearing glyph) (lglyph-width glyph))
-             ;; It seems that this glyph is designed to be rendered
-             ;; before the base glyph.
-             (lglyph-set-adjustment glyph (- base-width) 0 0)
-           (if (>= (lglyph-lbearing glyph) 0)
-               ;; Align the horizontal center of this glyph to the
-               ;; horizontal center of the base glyph.
-               (let ((width (- (lglyph-rbearing glyph)
-                               (lglyph-lbearing glyph))))
-                 (lglyph-set-adjustment glyph
-                                        (- (/ (- base-width width) 2)
-                                           (lglyph-lbearing glyph)
-                                           base-width) 0 0))))
-         (setq idx (1+ idx))))))
+        (if (font-get font :combining-capability)
+            (font-shape-gstring gstring)
+          (setq base-width (lglyph-width (lgstring-glyph gstring 0)))
+          (while (< idx nglyphs)
+            (setq glyph (lgstring-glyph gstring idx))
+            (lglyph-set-from-to glyph 0 (1- nchars))
+            (if (>= (lglyph-lbearing glyph) (lglyph-width glyph))
+                ;; It seems that this glyph is designed to be rendered
+                ;; before the base glyph.
+                (lglyph-set-adjustment glyph (- base-width) 0 0)
+              (if (>= (lglyph-lbearing glyph) 0)
+                  ;; Align the horizontal center of this glyph to the
+                  ;; horizontal center of the base glyph.
+                  (let ((width (- (lglyph-rbearing glyph)
+                                  (lglyph-lbearing glyph))))
+                    (lglyph-set-adjustment glyph
+                                           (- (/ (- base-width width) 2)
+                                              (lglyph-lbearing glyph)
+                                              base-width) 0 0))))
+            (setq idx (1+ idx)))))))
     gstring))
 
 (let* ((base "[\u05D0-\u05F2]")