scalefontsize fixed (#2765)

This commit is contained in:
isentropic 2020-06-09 15:37:39 +09:00 committed by GitHub
parent e49eb9bc83
commit a992effa5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 9 deletions

View File

@ -124,7 +124,11 @@ export
center, center,
BezierCurve, BezierCurve,
plotattr plotattr,
scalefontsize,
scalefontsizes,
resetfontsizes
# --------------------------------------------------------- # ---------------------------------------------------------

View File

@ -358,9 +358,15 @@ end
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()` 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) function scalefontsizes(factor::Number)
for k in (:titlefontsize, :guidefontsize, :tickfontsize, :legendfontsize) for k in (:titlefontsize, :legendfontsize, :legendtitlefontsize)
scalefontsize(k, factor) scalefontsize(k, factor)
end end
for letter in (:x,:y,:z)
for k in (:guidefontsize, :tickfontsize)
scalefontsize(Symbol(letter, k), factor)
end
end
end end
""" """
@ -369,15 +375,27 @@ end
Resets font sizes to initial default values. Resets font sizes to initial default values.
""" """
function scalefontsizes() function scalefontsizes()
for k in (:titlefontsize, :guidefontsize, :tickfontsize, :legendfontsize) for k in (:titlefontsize, :legendfontsize, :legendtitlefontsize)
f = default(k) f = default(k)
if k in keys(_initial_fontsizes) if k in keys(_initial_fontsizes)
factor = f / _initial_fontsizes[k] factor = f / _initial_fontsizes[k]
scalefontsize(k, 1.0/factor) scalefontsize(k, 1.0/factor)
end end
end end
for letter in (:x,:y,:z)
for k in (:guidefontsize, :tickfontsize)
if k in keys(_initial_fontsizes)
f = default(Symbol(letter, k))
factor = f / _initial_fontsizes[k]
scalefontsize(Symbol(letter, k), 1.0/factor)
end
end
end
end end
resetfontsizes() = scalefontsizes()
"Wrap a string with font info" "Wrap a string with font info"
struct PlotText struct PlotText
str::AbstractString str::AbstractString