diff --git a/src/args.jl b/src/args.jl index 1d1f0a0c..b3baa777 100644 --- a/src/args.jl +++ b/src/args.jl @@ -336,6 +336,12 @@ const _all_defaults = KW[ _axis_defaults_byletter ] +# to be able to reset font sizes to initial values +const _initial_fontsizes = Dict(:titlefont => _subplot_defaults[:titlefont].pointsize, + :legendfont => _subplot_defaults[:legendfont].pointsize, + :tickfont => _axis_defaults[:tickfont].pointsize, + :guidefont => _axis_defaults[:guidefont].pointsize) + const _all_args = sort(collect(union(map(keys, _all_defaults)...))) RecipesBase.is_key_supported(k::Symbol) = is_attr_supported(k) @@ -522,7 +528,6 @@ function default(d::KW, k::Symbol) end - # ----------------------------------------------------------------------------- # if arg is a valid color value, then set d[csym] and return true diff --git a/src/components.jl b/src/components.jl index 9db2f04b..2962f184 100644 --- a/src/components.jl +++ b/src/components.jl @@ -297,12 +297,33 @@ function scalefontsize(k::Symbol, factor::Number) f.pointsize = round(Int, factor * f.pointsize) default(k, f) end + +""" + scalefontsizes(factor::Number) + +Scales all **current** font sizes by `factor`. For example `scalefontsizes(1.1)` increases all current font sizes by 10%. To reset to initial sizes, use `scalefontsizes()` +""" function scalefontsizes(factor::Number) for k in (:titlefont, :guidefont, :tickfont, :legendfont) scalefontsize(k, factor) end end +""" + scalefontsizes() + +Resets font sizes to initial default values. +""" +function scalefontsizes() + for k in (:titlefont, :guidefont, :tickfont, :legendfont) + f = default(k) + if k in keys(_initial_fontsizes) + factor = f.pointsize / _initial_fontsizes[k] + scalefontsize(k, 1.0/factor) + end + end +end + "Wrap a string with font info" immutable PlotText str::AbstractString