fix drunken text
by always using Pango and Cairo commands that depend on the baseline of text, instead of sometimes using top and sometimes using baseline
This commit is contained in:
parent
ecefaeee8b
commit
03aee62647
|
@ -1346,10 +1346,9 @@
|
|||
(cairo_move_to cr
|
||||
(align-x/delta (+ x w) 0)
|
||||
(let ([bl (- flh ld)])
|
||||
(- (align-y/delta (+ y bl) 0)
|
||||
(align-y/delta bl 0))))
|
||||
(align-y/delta (+ y bl) 0)))
|
||||
;; Here's the draw command, which uses most of the time in this mode:
|
||||
(pango_cairo_show_layout cr layout))
|
||||
(pango_cairo_show_layout_line cr (pango_layout_get_line layout 0)))
|
||||
(values (if blank? 0.0 (+ w lw)) (max h lh) (max d ld) (max a la))))))
|
||||
(when rotate? (cairo_restore cr))))))))
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
(define PangoLanguage (_cpointer 'PangoLanguage))
|
||||
(define PangoCoverage (_cpointer 'PangoCoverage))
|
||||
(define PangoLayoutIter (_cpointer 'PangoLayoutIter))
|
||||
(define PangoLayoutLine (_cpointer 'PangoLayoutLine))
|
||||
|
||||
(define-cstruct _PangoRectangle ([x _int]
|
||||
[y _int]
|
||||
|
@ -156,6 +157,7 @@
|
|||
(define-pangocairo pango_cairo_update_layout (_fun _cairo_t PangoLayout -> _void))
|
||||
(define-pango pango_layout_set_text (_fun PangoLayout [s : _string] [_int = -1] -> _void))
|
||||
(define-pangocairo pango_cairo_show_layout (_fun _cairo_t PangoLayout -> _void))
|
||||
(define-pangocairo pango_cairo_show_layout_line (_fun _cairo_t PangoLayoutLine -> _void))
|
||||
(define-pangocairo pango_cairo_show_glyph_string (_fun _cairo_t PangoFont _PangoGlyphString-pointer -> _void))
|
||||
|
||||
(define-pango pango_layout_iter_free (_fun PangoLayoutIter -> _void)
|
||||
|
@ -166,6 +168,10 @@
|
|||
(define-pango pango_layout_iter_next_run (_fun PangoLayoutIter -> _bool))
|
||||
(define-pango pango_layout_iter_get_run_readonly (_fun PangoLayoutIter -> (_or-null _PangoGlyphItem-pointer)))
|
||||
|
||||
(define-pangocairo pango_layout_get_line (_fun PangoLayout _int -> PangoLayoutLine))
|
||||
(define-pangocairo pango_layout_get_line_readonly (_fun PangoLayout _int -> PangoLayoutLine)
|
||||
#:fail (lambda () pango_layout_get_line))
|
||||
|
||||
(define-pango pango_layout_get_context (_fun PangoLayout -> PangoContext)) ;; not an allocator
|
||||
(define-pango pango_layout_get_extents (_fun PangoLayout _pointer _PangoRectangle-pointer -> _void))
|
||||
(define-pango pango_layout_get_baseline (_fun PangoLayout -> _int)
|
||||
|
|
Loading…
Reference in New Issue
Block a user