create dict _initial_fontsizes and copy from that. creates new method scalefontsizes() [no keyword]

This commit is contained in:
Florian Oswald 2017-05-17 17:10:21 +02:00
parent fdf699bf35
commit 9c2c548874
2 changed files with 14 additions and 18 deletions

View File

@ -335,9 +335,11 @@ const _all_defaults = KW[
_axis_defaults_byletter _axis_defaults_byletter
] ]
# to be able to reset things to initial values # to be able to reset font sizes to initial values
const _all_initial_defaults = deepcopy(_all_defaults) const _initial_fontsizes = Dict(:titlefont => deepcopy(_subplot_defaults[:titlefont]),
const _axis_initial_defaults = deepcopy(_axis_defaults) :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)...))) const _all_args = sort(collect(union(map(keys, _all_defaults)...)))

View File

@ -303,21 +303,15 @@ function scalefontsizes(factor::Number)
end end
end end
function resetfontsize(k::Symbol) "Resets font sizes to initial default values"
i = initial(k) function scalefontsizes()
f = default(k) for k in (:titlefont, :guidefont, :tickfont, :legendfont)
# some fonts don't have an initial value! f = default(k)
if i != false if haskey(_initial_fontsizes,k)
f.pointsize = i.pointsize factor = f.pointsize / _initial_fontsizes[k].pointsize
default(k, i) scalefontsize(k, 1.0/factor)
end end
end end
"Reset all fonts to initial size"
function resetfontsizes()
for k in (:titlefont, :guidefont, :tickfont, :legendfont)
resetfontsize(k)
end
end end
"Wrap a string with font info" "Wrap a string with font info"