diff --git a/src/args.jl b/src/args.jl index be5c564c..f93aeae6 100644 --- a/src/args.jl +++ b/src/args.jl @@ -335,9 +335,11 @@ const _all_defaults = KW[ _axis_defaults_byletter ] -# to be able to reset things to initial values -const _all_initial_defaults = deepcopy(_all_defaults) -const _axis_initial_defaults = deepcopy(_axis_defaults) +# to be able to reset font sizes to initial values +const _initial_fontsizes = Dict(:titlefont => deepcopy(_subplot_defaults[:titlefont]), + :legendfont => deepcopy(_subplot_defaults[:legendfont]), + :tickfont => deepcopy(_axis_defaults[:tickfont]), + :guidefont => deepcopy(_axis_defaults[:guidefont])) const _all_args = sort(collect(union(map(keys, _all_defaults)...))) diff --git a/src/components.jl b/src/components.jl index e7eb74d6..1f53f2d1 100644 --- a/src/components.jl +++ b/src/components.jl @@ -303,21 +303,15 @@ function scalefontsizes(factor::Number) end end -function resetfontsize(k::Symbol) - i = initial(k) - f = default(k) - # some fonts don't have an initial value! - if i != false - f.pointsize = i.pointsize - default(k, i) - end -end - -"Reset all fonts to initial size" -function resetfontsizes() - for k in (:titlefont, :guidefont, :tickfont, :legendfont) - resetfontsize(k) - end +"Resets font sizes to initial default values" +function scalefontsizes() + for k in (:titlefont, :guidefont, :tickfont, :legendfont) + f = default(k) + if haskey(_initial_fontsizes,k) + factor = f.pointsize / _initial_fontsizes[k].pointsize + scalefontsize(k, 1.0/factor) + end + end end "Wrap a string with font info"