racket/draw: fix handling of font hinting
This commit is contained in:
parent
0dbd3f1610
commit
9e657a2026
|
@ -1242,7 +1242,7 @@
|
||||||
cr
|
cr
|
||||||
(do-text cr #f s 0 0 use-font combine? offset 0.0))))))
|
(do-text cr #f s 0 0 use-font combine? offset 0.0))))))
|
||||||
|
|
||||||
(define/private (get-smoothing-index)
|
(define/private (get-smoothing-index font)
|
||||||
(+ (case (dc-adjust-smoothing (send font get-smoothing))
|
(+ (case (dc-adjust-smoothing (send font get-smoothing))
|
||||||
[(default) 0]
|
[(default) 0]
|
||||||
[(unsmoothed) 1]
|
[(unsmoothed) 1]
|
||||||
|
@ -1252,7 +1252,7 @@
|
||||||
[(aligned) 0]
|
[(aligned) 0]
|
||||||
[(unaligned) 4])))
|
[(unaligned) 4])))
|
||||||
|
|
||||||
(define/private (get-context cr smoothing-index)
|
(define/private (get-context cr smoothing-index font)
|
||||||
(or (vector-ref contexts smoothing-index)
|
(or (vector-ref contexts smoothing-index)
|
||||||
(let ([c (pango_font_map_create_context
|
(let ([c (pango_font_map_create_context
|
||||||
(let ([fm (vector-ref font-maps smoothing-index)])
|
(let ([fm (vector-ref font-maps smoothing-index)])
|
||||||
|
@ -1281,8 +1281,8 @@
|
||||||
(regexp-replace* #rx"[\uFFFE\uFFFF]" s "\uFFFD")
|
(regexp-replace* #rx"[\uFFFE\uFFFF]" s "\uFFFD")
|
||||||
s)]
|
s)]
|
||||||
[rotate? (and draw-mode (not (zero? angle)))]
|
[rotate? (and draw-mode (not (zero? angle)))]
|
||||||
[smoothing-index (get-smoothing-index)]
|
[smoothing-index (get-smoothing-index font)]
|
||||||
[context (get-context cr smoothing-index)])
|
[context (get-context cr smoothing-index font)])
|
||||||
(when draw-mode
|
(when draw-mode
|
||||||
(when (eq? text-mode 'solid)
|
(when (eq? text-mode 'solid)
|
||||||
(unless rotate?
|
(unless rotate?
|
||||||
|
@ -1851,8 +1851,8 @@
|
||||||
(define/private (get-font-metric cr sel)
|
(define/private (get-font-metric cr sel)
|
||||||
(let* ([desc (get-pango font)]
|
(let* ([desc (get-pango font)]
|
||||||
[attrs (send font get-pango-attrs)]
|
[attrs (send font get-pango-attrs)]
|
||||||
[index (get-smoothing-index)]
|
[index (get-smoothing-index font)]
|
||||||
[context (get-context cr index)]
|
[context (get-context cr index font)]
|
||||||
[fontmap (vector-ref font-maps index)]
|
[fontmap (vector-ref font-maps index)]
|
||||||
[font (pango_font_map_load_font fontmap context desc)])
|
[font (pango_font_map_load_font fontmap context desc)])
|
||||||
(and font ;; else font match failed
|
(and font ;; else font match failed
|
||||||
|
|
Loading…
Reference in New Issue
Block a user