diff options
author | Daniel Kochmański <daniel@turtleware.eu> | 2024-06-06 20:22:58 +0200 |
---|---|---|
committer | Daniel Kochmański <daniel@turtleware.eu> | 2024-06-28 12:45:34 +0200 |
commit | de6aaaec7f95db039fc97d417cdad15426c51c1d (patch) | |
tree | 66eea4e70067367501ba991752028cb39e1088d9 /Extensions | |
parent | 154dbc8ba03202d5e0247fce5f468efd6a1c01fe (diff) |
medium: add graphics-state-layout-mixin that represents directions
LINE-DIRECTION and PAGE-DIRECTION are essential for rendering text. Technically
they could be used by other compound operations that introduce an order between
elements.
Diffstat (limited to 'Extensions')
-rw-r--r-- | Extensions/fonts/ttf-medium-mixin.lisp | 10 | ||||
-rw-r--r-- | Extensions/render/backend/medium.lisp | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Extensions/fonts/ttf-medium-mixin.lisp b/Extensions/fonts/ttf-medium-mixin.lisp index 16c6c5d4..e0bcd46a 100644 --- a/Extensions/fonts/ttf-medium-mixin.lisp +++ b/Extensions/fonts/ttf-medium-mixin.lisp @@ -41,10 +41,10 @@ a font implementing the protocol defined below.")) (defmethod medium-draw-text* ((medium ttf-medium-mixin) string x y start end align-x align-y toward-x toward-y transform-glyphs) - (let* ((rotation (climi::draw-text-rotation* x y toward-x toward-y)) - (scaling (make-scaling-transformation* 1 -1 x y)) - (combined (compose-transformations rotation scaling)) - (direction (climi::canonical-text-direction transform-glyphs))) + (let* ((line-dir (climi::medium-line-direction)) + (rotation (climi::draw-text-rotation* x y toward-x toward-y line-dir)) + (scaling (make-scaling-transformation* 1 -1 x y)) + (combined (compose-transformations rotation scaling))) (multiple-value-bind (width height cursor-dx cursor-dy ascent) (text-size medium string :start start :end end) (declare (ignore cursor-dx cursor-dy)) @@ -66,7 +66,7 @@ a font implementing the protocol defined below.")) (loop with font = (text-style-mapping (port medium) (medium-text-style medium)) with loader = (zpb-ttf-font-loader (clime:font-face font)) with units->pixels = (slot-value font 'units->pixels) - for glyph = nil then (font-glyph-info font code direction) + for glyph = nil then (font-glyph-info font code line-dir) for current-x = x then (+ current-x (glyph-info-advance-dx glyph)) for current-y = y then (+ current-y (glyph-info-advance-dy glyph)) for code across (string-glyph-codes string :start start :end end) diff --git a/Extensions/render/backend/medium.lisp b/Extensions/render/backend/medium.lisp index a3512edf..b46dae5e 100644 --- a/Extensions/render/backend/medium.lisp +++ b/Extensions/render/backend/medium.lisp @@ -213,9 +213,9 @@ (text-style (medium-text-style medium)) (font (text-style-mapping port text-style)) (glyph-ids (glyph-codes-buffer medium (- end start))) - (direction (climb:canonical-text-direction transform-glyphs)) + (direction (climi::medium-line-direction medium)) (transformation (climb:medium-text-transformation - medium x y toward-x toward-y direction))) + medium x y toward-x toward-y))) (multiple-value-bind (x y xmin ymin xmax ymax) (mcclim-truetype:font-prepare-glyphs glyph-ids font string start end 0 0 align-x align-y direction) |