Skip to content

Commit d788f86

Browse files
authored
fix some runic inconsistencies (#422)
1 parent ee10f35 commit d788f86

File tree

3 files changed

+49
-55
lines changed

3 files changed

+49
-55
lines changed

ext/FreeTypeExt.jl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ end
7676
add_mono(fts...) = tuple(map(x -> x * "Mono", fts)..., fts...)
7777

7878
# COV_EXCL_START
79-
fallback_fonts() =
80-
# those fallback fonts are likely to fail braille characters
81-
if Sys.islinux()
79+
# those fallback fonts are likely to fail braille characters
80+
fallback_fonts() = if Sys.islinux()
8281
add_mono("DejaVu Sans ", "Ubuntu ", "Noto ", "Free", "Liberation ") # NOTE: trailing space intended
8382
elseif Sys.isbsd()
8483
("Courier New", "Helvetica")
@@ -192,8 +191,7 @@ rightinkbound(ext::FontExtent) = leftinkbound(ext) + inkwidth(ext)
192191
bottominkbound(ext::FontExtent) = hbearing_ori_to_top(ext) - inkheight(ext)
193192
topinkbound(ext::FontExtent) = hbearing_ori_to_top(ext)
194193

195-
FontExtent(fontmetric::FT_Glyph_Metrics, scale::T = 64.0) where {T <: AbstractFloat} =
196-
FontExtent(
194+
FontExtent(fontmetric::FT_Glyph_Metrics, scale::T = 64.0) where {T <: AbstractFloat} = FontExtent(
197195
SVector{2, T}(fontmetric.vertBearingX, fontmetric.vertBearingY) ./ scale,
198196
SVector{2, T}(fontmetric.horiBearingX, fontmetric.horiBearingY) ./ scale,
199197
SVector{2, T}(fontmetric.horiAdvance, fontmetric.vertAdvance) ./ scale,
@@ -257,9 +255,9 @@ function glyph_bitmap(bitmap::FT_Bitmap)
257255
return bmp
258256
end
259257

260-
render_face(face::FTFont, glyph, pixelsize::Integer; kw...) =
261-
let gl = load_glyph(face, glyph, pixelsize; kw...)
262-
glyph_bitmap(gl.bitmap), FontExtent(gl.metrics)
258+
function render_face(face::FTFont, glyph, pixelsize::Integer; kw...)
259+
gl = load_glyph(face, glyph, pixelsize; kw...)
260+
return glyph_bitmap(gl.bitmap), FontExtent(gl.metrics)
263261
end
264262

265263
extents(face::FTFont, glyph, pixelsize::Integer) =
@@ -444,8 +442,7 @@ function ft_done()
444442
end
445443
end
446444

447-
add_recursive(result, path) =
448-
for p in readdir(path)
445+
add_recursive(result, path) = for p in readdir(path)
449446
if (pabs = joinpath(path, p)) |> isdir
450447
push!(result, pabs)
451448
add_recursive(result, pabs)

src/common.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ const ASPECT_RATIO = Ref(4 / 3)
214214
const DEFAULT_HEIGHT = Ref(15)
215215
const DEFAULT_WIDTH = Ref(round(Int, DEFAULT_HEIGHT[] * 2ASPECT_RATIO[]))
216216

217-
colormode() =
218-
if (cm = COLORMODE[]) Crayons.COLORS_256
217+
colormode() = if (cm = COLORMODE[]) Crayons.COLORS_256
219218
8
220219
elseif cm Crayons.COLORS_24BIT
221220
24
@@ -252,8 +251,7 @@ function init_8bit()
252251
return nothing
253252
end
254253

255-
get_have_truecolor() =
256-
if isdefined(Base, :get_have_truecolor)
254+
get_have_truecolor() = if isdefined(Base, :get_have_truecolor)
257255
Base.get_have_truecolor()
258256
else
259257
# see gist.github.com/XVilka/8346728#checking-for-colorterm
@@ -289,13 +287,11 @@ function default_size!(;
289287
return DEFAULT_HEIGHT[], DEFAULT_WIDTH[] # `displaysize` order convention
290288
end
291289

292-
function char_marker(marker::MarkerType)::Char
293-
return if marker isa Symbol
294-
get(MARKERS, marker, MARKERS[:circle])
295-
else
296-
length(marker) 1 || throw(ArgumentError("`marker` keyword has a non unit length"))
297-
first(marker)
298-
end
290+
char_marker(marker::MarkerType)::Char = if marker isa Symbol
291+
get(MARKERS, marker, MARKERS[:circle])
292+
else
293+
length(marker) 1 || throw(ArgumentError("`marker` keyword has a non unit length"))
294+
first(marker)
299295
end
300296

301297
iterable(obj::AbstractVecOrMat) = obj

src/interface/histogram.jl

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -160,37 +160,37 @@ $(
160160
161161
```julia-repl
162162
julia> histogram(randn(1_000) * .1, closed=:right, nbins=15)
163-
┌ ┐
164-
(-0.3 , -0.25] ┤▎ 1
165-
(-0.25, -0.2 ] ┤██▉ 17
166-
(-0.2 , -0.15] ┤█████████▍ 53
167-
(-0.15, -0.1 ] ┤████████████████▎ 92
168-
(-0.1 , -0.05] ┤████████████████████████▋ 141
169-
(-0.05, 0.0 ] ┤███████████████████████████████████ 200
170-
( 0.0 , 0.05] ┤█████████████████████████████████▋ 192
171-
( 0.05, 0.1 ] ┤█████████████████████████▏ 143
172-
( 0.1 , 0.15] ┤████████████████▎ 92
173-
( 0.15, 0.2 ] ┤███████▊ 45
174-
( 0.2 , 0.25] ┤██▋ 15
175-
( 0.25, 0.3 ] ┤█▍ 8
176-
( 0.3 , 0.35] ┤▎ 1
177-
└ ┘
178-
Frequency
163+
┌ ┐
164+
(-0.3 , -0.25] ┤▎ 1
165+
(-0.25, -0.2 ] ┤██▉ 17
166+
(-0.2 , -0.15] ┤█████████▍ 53
167+
(-0.15, -0.1 ] ┤████████████████▎ 92
168+
(-0.1 , -0.05] ┤████████████████████████▋ 141
169+
(-0.05, 0.0 ] ┤███████████████████████████████████ 200
170+
( 0.0 , 0.05] ┤█████████████████████████████████▋ 192
171+
( 0.05, 0.1 ] ┤█████████████████████████▏ 143
172+
( 0.1 , 0.15] ┤████████████████▎ 92
173+
( 0.15, 0.2 ] ┤███████▊ 45
174+
( 0.2 , 0.25] ┤██▋ 15
175+
( 0.25, 0.3 ] ┤█▍ 8
176+
( 0.3 , 0.35] ┤▎ 1
177+
└ ┘
178+
Frequency
179179
julia> histogram(randn(100_000) .* .1, nbins=60, vertical=true, height=10)
180-
┌ ┐
181-
8_093 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃█▇▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
182-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████▆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
183-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▇██████▅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
184-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████████▄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
185-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃██████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
186-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂████████████▂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
187-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂██████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
188-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁████████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
189-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁▅██████████████████▅▁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
190-
0 ⠀⠀⠀⠀⠀⠀▁▁▂▃▅██████████████████████▆▃▂▁▁⠀⠀⠀⠀⠀⠀⠀
191-
└ ┘
192-
⠀-0.44⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀0.46⠀
193-
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀μ ± σ: 0.0 ± 0.1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
180+
┌ ┐
181+
8_093 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃█▇▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
182+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████▆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
183+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▇██████▅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
184+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████████▄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
185+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃██████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
186+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂████████████▂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
187+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂██████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
188+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁████████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
189+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁▅██████████████████▅▁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
190+
0 ⠀⠀⠀⠀⠀⠀▁▁▂▃▅██████████████████████▆▃▂▁▁⠀⠀⠀⠀⠀⠀⠀
191+
└ ┘
192+
⠀-0.44⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀0.46⠀
193+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀μ ± σ: 0.0 ± 0.1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
194194
```
195195
196196
# See also
@@ -207,10 +207,11 @@ function histogram(x::AbstractArray; closed = :left, vertical = false, stats = t
207207
mx, Mx = extrema(x_plot)
208208
μ = sum(x_plot) / len
209209
σ = (sum((x_plot .- μ) .^ 2) / len)
210-
"μ ± σ: " *
211-
lpad(round(μ; digits), digits + 1) *
212-
" ± " *
213-
lpad(round(σ; digits), digits + 1)
210+
(
211+
"μ ± σ: " *
212+
lpad(round(μ; digits), digits + 1) * " ± " *
213+
lpad(round(σ; digits), digits + 1)
214+
)
214215
else
215216
""
216217
end

0 commit comments

Comments
 (0)