Skip to content

Commit 6a593ce

Browse files
committed
Merge remote-tracking branch 'deeglaze/master' into ah/pr5-2
2 parents 008b6a7 + cf95637 commit 6a593ce

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

plot-doc/plot/scribblings/params.scrbl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ The opacity of the background and foreground colors.
9595
The font size (in drawing units), face, and family of the title, axis labels, tick labels, and other labels.
9696
}
9797

98+
@deftogether[((defparam plot-legend-font-size size (or/c (>=/c 0) #f) #:value #f)
99+
(defparam plot-legend-font-face face (or/c string? #f) #:value #f)
100+
(defparam plot-legend-font-family family (or/c font-family/c #f) #:value #f))]{
101+
The font size (in drawing units), face, and family to prefer for the legend text. If set to @racket[#f], then the corresponding @racket[plot-font-X] parameter is used.
102+
}
103+
98104
@deftogether[((defparam plot-legend-anchor anchor anchor/c #:value 'top-left)
99105
(defparam plot-legend-box-alpha alpha (real-in 0 1) #:value 2/3))]{
100106
The placement of the legend and the opacity of its background.

plot-lib/plot/private/common/parameter-groups.rkt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
plot-background plot-background-alpha
3333
plot-line-width plot-tick-size
3434
plot-font-size plot-font-face plot-font-family
35+
plot-legend-font-size plot-legend-font-face plot-legend-font-family
3536
plot-legend-anchor plot-legend-box-alpha
3637
plot-axes? plot-tick-labels
3738
plot-decorations?
@@ -92,6 +93,9 @@
9293
Nonnegative-Real
9394
(U False String)
9495
Font-Family
96+
(U False Nonnegative-Real)
97+
(U False String)
98+
(U False Font-Family)
9599
Anchor
96100
Nonnegative-Real
97101
(List Boolean Boolean Boolean Boolean Boolean Boolean)

plot-lib/plot/private/common/parameters.rkt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
(defparam2 plot-font-size size Real Nonnegative-Real 11 (nonnegative-rational 'plot-font-size))
7272
(defparam plot-font-face face (U String #f) #f)
7373
(defparam plot-font-family family Font-Family 'roman)
74+
(defparam plot-legend-font-size size (U Nonnegative-Real #f) #f)
75+
(defparam plot-legend-font-face face (U String #f) #f)
76+
(defparam plot-legend-font-family family (U Font-Family #f) #f)
7477
(defparam plot-legend-anchor anchor Anchor 'top-left)
7578
(defparam2 plot-legend-box-alpha alpha Real Nonnegative-Real 2/3 (unit-ivl 'plot-legend-box-alpha))
7679
(defparam plot-animating? Boolean #f)

plot-lib/plot/private/common/plot-device.rkt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,14 @@
593593
legend-entries)
594594

595595
(match-define (vector (ivl x-min x-max) (ivl y-min y-max)) rect)
596+
597+
(define old-size (send (send dc get-font) get-point-size))
598+
(define old-face (send (send dc get-font) get-face))
599+
(define old-family (send (send dc get-font) get-family))
600+
(set-font-attribs
601+
(or (plot-legend-font-size) old-size)
602+
(or (plot-legend-font-face) old-face)
603+
(or (plot-legend-font-family) old-family))
596604

597605
(define-values (_1 label-y-size baseline _2) (get-text-extent (first labels)))
598606
(define horiz-gap (get-text-width " "))
@@ -664,5 +672,8 @@
664672
(draw-proc this draw-x-size draw-y-size)
665673
(send entry-pd restore-drawing-params))
666674

675+
;; reset plot font attributes
676+
(set-font-attribs old-size old-face old-family)
677+
667678
(clear-clipping-rect))
668679
)) ; end class

plot-lib/plot/private/utils-and-no-gui.rkt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
plot-font-size
8484
plot-font-face
8585
plot-font-family
86+
plot-legend-font-size
87+
plot-legend-font-face
88+
plot-legend-font-family
8689
plot-legend-anchor
8790
plot-legend-box-alpha
8891
plot-decorations?

0 commit comments

Comments
 (0)