emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114247: composite.el (compose-gstring-for-graphic):


From: Kenichi Handa
Subject: [Emacs-diffs] trunk r114247: composite.el (compose-gstring-for-graphic): Handle enclosing mark.
Date: Thu, 12 Sep 2013 14:49:22 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114247 [merge]
revision-id: address@hidden
parent: address@hidden
parent: address@hidden
committer: K. Handa <address@hidden>
branch nick: trunk
timestamp: Thu 2013-09-12 23:49:14 +0900
message:
  composite.el (compose-gstring-for-graphic): Handle enclosing mark.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/composite.el              
composite.el-20091113204419-o5vbwnq5f7feedwu-1730
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-09-12 06:58:57 +0000
+++ b/lisp/ChangeLog    2013-09-12 14:48:18 +0000
@@ -1,3 +1,8 @@
+2013-09-12  Kenichi Handa  <address@hidden>
+
+       * composite.el (compose-gstring-for-graphic): Handle enclosing
+       mark.
+
 2013-09-12  Glenn Morris  <address@hidden>
 
        * vc/vc-svn.el (vc-svn-dir-status-files, vc-svn-dir-extra-headers)

=== modified file 'lisp/composite.el'
--- a/lisp/composite.el 2013-06-21 12:24:37 +0000
+++ b/lisp/composite.el 2013-09-12 14:45:28 +0000
@@ -555,7 +555,11 @@
                 (rbearing (lglyph-rbearing glyph))
                 (lbearing (lglyph-lbearing glyph))
                 (center (/ (+ lbearing rbearing) 2))
+                ;; Artificial vertical gap between the glyphs.
                 (gap (round (* (font-get (lgstring-font gstring) :size) 0.1))))
+           (if (= gap 0)
+               ;; Assure at least 1 pixel vertical gap.
+               (setq gap 1))
            (dotimes (i nchars)
              (setq glyph (lgstring-glyph gstring i))
              (when (> i 0)
@@ -566,8 +570,10 @@
                       (as (lglyph-ascent glyph))
                       (de (lglyph-descent glyph))
                       (ce (/ (+ lb rb) 2))
+                      (w (lglyph-width glyph))
                       xoff yoff)
-                 (when (and class (>= class 200) (<= class 240))
+                 (cond
+                  ((and class (>= class 200) (<= class 240))
                    (setq xoff 0 yoff 0)
                    (cond
                     ((= class 200)
@@ -621,6 +627,38 @@
                          rb (+ lb xoff)
                          as (- as yoff)
                          de (+ de yoff)))
+                  ((and (= class 0)
+                        (eq (get-char-code-property (lglyph-char glyph)
+                                                    'general-category) 'Me))
+                   ;; Artificially layouting glyphs in an enclosing
+                   ;; mark is difficult.  All we can do is to adjust
+                   ;; the x-offset and width of the base glyph to
+                   ;; align it at the center of the glyph of the
+                   ;; enclosing mark hoping that the enclosing mark
+                   ;; is big enough.  We also have to adjust the
+                   ;; x-offset and width of the mark ifself properly
+                   ;; depending on how the glyph is designed
+
+                   ;; (non-spacing or not).  For instance, when we
+                   ;; have these glyphs:
+                   ;;   X position  |
+                   ;;   base:       <-*-> lbearing=0 rbearing=5 width=5
+                   ;;   mark: <----------.> lb=-11 rb=2 w=0
+                   ;; we get a correct layout by moving them as this:
+                   ;;   base:           <-*-> XOFF=4 WAD=9
+                   ;;   mark:       <----------.> xoff=2 wad=4
+                   ;; we have moved the base to the left by 4-pixel
+                   ;; and make its width 9-pixel, then move the mark
+                   ;; to the left 2-pixel and make its width 4-pixel.
+                   (let* (;; Adjustment for the base glyph
+                          (XOFF (/ (- rb lb width) 2))
+                          (WAD (+ width XOFF))
+                          ;; Adjustment for the enclosing mark glyph
+                          (xoff (- (+ lb WAD)))
+                          (wad (- rb lb WAD)))
+                     (lglyph-set-adjustment glyph xoff 0 wad)
+                     (setq glyph (lgstring-glyph gstring 0))
+                     (lglyph-set-adjustment glyph XOFF 0 WAD))))
                  (if (< ascent as)
                      (setq ascent as))
                  (if (< descent de)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]