fix bug when a line only has one word ends with hyphen
This commit is contained in:
parent
564f33ba27
commit
b6ee3dedcc
10
ekp.el
10
ekp.el
@ -546,7 +546,8 @@ return the value of KEY in plist."
|
|||||||
"Line glues include glues before first box and after last box.
|
"Line glues include glues before first box and after last box.
|
||||||
So the length of line glues is: line-boxes-num + 1"
|
So the length of line glues is: line-boxes-num + 1"
|
||||||
(let* ((boxes-widths (ekp-boxes-widths string))
|
(let* ((boxes-widths (ekp-boxes-widths string))
|
||||||
(boxes-num (length (ekp-boxes string)))
|
(boxes (ekp-boxes string))
|
||||||
|
(boxes-num (length boxes))
|
||||||
(glues-types (ekp-glues-types string))
|
(glues-types (ekp-glues-types string))
|
||||||
(ideal-prefixs (ekp-ideal-prefixs string))
|
(ideal-prefixs (ekp-ideal-prefixs string))
|
||||||
(max-prefixs (ekp-max-prefixs string))
|
(max-prefixs (ekp-max-prefixs string))
|
||||||
@ -564,7 +565,12 @@ So the length of line glues is: line-boxes-num + 1"
|
|||||||
(setq line-glue
|
(setq line-glue
|
||||||
(cond
|
(cond
|
||||||
((= 1 (length line-boxes-widths))
|
((= 1 (length line-boxes-widths))
|
||||||
(list 0 (- line-pixel (aref line-boxes-widths 0))))
|
(if (ekp-hyphenate-p glues-types end)
|
||||||
|
;; ends with hyphen, minus hyphen-pixel
|
||||||
|
(list 0 (- line-pixel
|
||||||
|
(ekp-hyphen-pixel string)
|
||||||
|
(aref line-boxes-widths 0)))
|
||||||
|
(list 0 (- line-pixel (aref line-boxes-widths 0)))))
|
||||||
(is-last
|
(is-last
|
||||||
(append '(0)
|
(append '(0)
|
||||||
(mapcar #'ekp-glue-ideal-pixel line-glues-types)
|
(mapcar #'ekp-glue-ideal-pixel line-glues-types)
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
;; (ekp-test-justify nil "fr" "Cascadia Next SC" 666)
|
;; (ekp-test-justify nil "fr" "Cascadia Next SC" 666)
|
||||||
;; (ekp-test-justify nil "de_DE" "Cascadia Next SC" 666)
|
;; (ekp-test-justify nil "de_DE" "Cascadia Next SC" 666)
|
||||||
;; (ekp-test-justify "zh" "en_US" "Noto Serif" 689)
|
;; (ekp-test-justify "zh" "en_US" "Noto Serif" 689)
|
||||||
;; (ekp-test-justify "zh" nil nil 250)
|
;; (ekp-test-justify "zh" nil nil 980)
|
||||||
|
|
||||||
;;; FIXME: font size also affect!
|
;;; FIXME: font size also affect!
|
||||||
|
|
||||||
@ -78,9 +78,3 @@
|
|||||||
(sit-for 0.00001))))))
|
(sit-for 0.00001))))))
|
||||||
|
|
||||||
;; (ekp-test-demo 400 800 1)
|
;; (ekp-test-demo 400 800 1)
|
||||||
|
|
||||||
;; (ekp-clear-caches)
|
|
||||||
;; (ekp-test-justify "zh2" "en_US" "Cascadia Next SC" 666)
|
|
||||||
;; (ekp-boxes (ekp-test-str "zh2" "en_US" "Cascadia Next SC"))
|
|
||||||
;; (ekp-split-to-boxes "用户可通过Emacs Lisp (elisp) 重新定义编辑行为")
|
|
||||||
;; (ekp-split-to-boxes "用户可通过Emacs Lisp (elisp) 重新定义编辑行为")
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user