From dfb89ef7f5e1cb83d4b1585cec316e3b81a36fbe Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Wed, 2 Nov 2016 10:20:33 -0400 Subject: [PATCH] scalefontsize/scalefontsizes; closes #560 --- src/components.jl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components.jl b/src/components.jl index 895f82bc..952a13dc 100644 --- a/src/components.jl +++ b/src/components.jl @@ -226,7 +226,7 @@ end # ----------------------------------------------------------------------- -immutable Font +type Font family::AbstractString pointsize::Int halign::Symbol @@ -283,6 +283,17 @@ function font(args...) Font(family, pointsize, halign, valign, rotation, color) end +function scalefontsize(k::Symbol, factor::Number) + f = default(k) + f.pointsize = round(Int, factor * f.pointsize) + default(k, f) +end +function scalefontsizes(factor::Number) + for k in (:titlefont, :guidefont, :tickfont, :legendfont) + scalefontsize(k, factor) + end +end + "Wrap a string with font info" immutable PlotText str::AbstractString