diff options
| author | Kenichi Handa | 2010-05-25 10:25:08 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-05-25 10:25:08 +0900 |
| commit | f668ef02cbdbb3544702bb58926a443be918a03f (patch) | |
| tree | bbc84b7aa2f9881dd3e79f6a25767c3d59d4d05d | |
| parent | cdf522217cd425ca6dabb1fc6c0fb7fb9c95883b (diff) | |
| download | emacs-f668ef02cbdbb3544702bb58926a443be918a03f.tar.gz emacs-f668ef02cbdbb3544702bb58926a443be918a03f.zip | |
Add Hebrew shaper.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/language/hebrew.el | 29 |
2 files changed, 35 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 061db502dc5..6bbcc1262b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-05-25 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * language/hebrew.el (hebrew-shape-gstring): New function. | ||
| 4 | Register it in composition-function-table for all Hebrew combining | ||
| 5 | characters. | ||
| 6 | |||
| 1 | 2010-05-24 Uday S Reddy <u.s.reddy@cs.bham.ac.uk> (tiny change) | 7 | 2010-05-24 Uday S Reddy <u.s.reddy@cs.bham.ac.uk> (tiny change) |
| 2 | 8 | ||
| 3 | * textmodes/fill.el (fill-region): Don't fill past the end (bug#6201). | 9 | * textmodes/fill.el (fill-region): Don't fill past the end (bug#6201). |
diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el index fd98fcfecb7..5c39bb22416 100644 --- a/lisp/language/hebrew.el +++ b/lisp/language/hebrew.el | |||
| @@ -85,6 +85,35 @@ Bidirectional editing is supported."))) | |||
| 85 | :mime-charset 'cp862) | 85 | :mime-charset 'cp862) |
| 86 | (define-coding-system-alias 'ibm862 'cp862) | 86 | (define-coding-system-alias 'ibm862 'cp862) |
| 87 | 87 | ||
| 88 | ;; Composition function for hebrew. | ||
| 89 | (defun hebrew-shape-gstring (gstring) | ||
| 90 | (setq gstring (font-shape-gstring gstring)) | ||
| 91 | (let ((header (lgstring-header gstring)) | ||
| 92 | (nchars (lgstring-char-len gstring)) | ||
| 93 | (nglyphs (lgstring-glyph-len gstring)) | ||
| 94 | (base-width (lglyph-width (lgstring-glyph gstring 0)))) | ||
| 95 | (while (> nglyphs 1) | ||
| 96 | (setq nglyphs (1- nglyphs)) | ||
| 97 | (let* ((glyph (lgstring-glyph gstring nglyphs)) | ||
| 98 | (adjust (and glyph (lglyph-adjustment glyph)))) | ||
| 99 | (if adjust | ||
| 100 | (setq nglyphs 0) | ||
| 101 | (if (>= (lglyph-lbearing glyph) 0) | ||
| 102 | (lglyph-set-adjustment glyph (- base-width) 0 0)))))) | ||
| 103 | gstring) | ||
| 104 | |||
| 105 | (let ((pattern1 "[\u05D0-\u05F2][\u0591-\u05BF\u05C1-\u05C5\u05C7]+") | ||
| 106 | (pattern2 "[\u05D0-\u05F2]\u200D[\u0591-\u05BF\u05C1-\u05C5\u05C7]+")) | ||
| 107 | (set-char-table-range | ||
| 108 | composition-function-table '(#x591 . #x5C7) | ||
| 109 | (list (vector pattern2 2 'hebrew-shape-gstring) | ||
| 110 | (vector pattern1 1 'hebrew-shape-gstring) | ||
| 111 | ["[\u0591-\u05C7]" 0 font-shape-gstring])) | ||
| 112 | (set-char-table-range | ||
| 113 | composition-function-table #x5C0 nil) | ||
| 114 | (set-char-table-range | ||
| 115 | composition-function-table #x5C6 nil)) | ||
| 116 | |||
| 88 | (provide 'hebrew) | 117 | (provide 'hebrew) |
| 89 | 118 | ||
| 90 | ;; arch-tag: 3ca04f32-3f1e-498e-af46-8267498ba5d9 | 119 | ;; arch-tag: 3ca04f32-3f1e-498e-af46-8267498ba5d9 |