Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Feb 4, 2023
1 parent 7ba7c46 commit 6822761
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ext/FreeTypeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function UnicodePlots.get_font_face(font = nothing, fallback = fallback_fonts())
face
end

UnicodePlots.save_png(args...; kw...) = FileIO.save(args...; kw...)
UnicodePlots.save_image(args...; kw...) = FileIO.save(args...; kw...)

"""
Match a font using the user-specified search string. Each part of the search string
Expand Down
4 changes: 2 additions & 2 deletions ext/ImageInTerminalExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ UnicodePlots.sixel_encode(args...; kw...) = ImageInTerminal.sixel_encode(args...
UnicodePlots.imshow(args...; kw...) = ImageInTerminal.imshow(args...; kw...)

function UnicodePlots.terminal_specs(img)
char_h = char_w = nothing
if ImageInTerminal.choose_sixel(img)
ans = ImageInTerminal.Sixel.TerminalTools.query_terminal("\e[16t", stdout)
if ans isa String && (m = match(r"\e\[6;(\d+);(\d+)t", ans)) nothing
char_h, char_w = tryparse.(Int, m.captures)
return char_h nothing && char_w nothing, char_h, char_w
end
end
false, nothing, nothing
char_h nothing && char_w nothing, char_h, char_w
end

UnicodePlots.imageplot(img::AbstractArray{<:Colorant}; kw...) =
Expand Down
4 changes: 2 additions & 2 deletions src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ end
# `FreeTypeExt` placeholders
function get_font_face end
function render_string! end
function save_png end
function save_image end

"""
png_image(p::Plot, font = nothing, pixelsize = 32, transparent = true, foreground = nothing, background = nothing, bounding_box = nothing, bounding_box_glyph = nothing)
Expand Down Expand Up @@ -597,7 +597,7 @@ function savefig(p::Plot, filename::AbstractString; color::Bool = false, kw...)
elseif ext == ".png"
# `png_image` can fail if fonts are not found: a warning has already been
# thrown there, so just bail out at this stage
(img = png_image(p; kw...)) nothing && save_png(filename, img)
(img = png_image(p; kw...)) nothing && save_image(filename, img)
else
"extension \"$ext\" is unsupported: `savefig` only supports writing to `txt` or `png` files" |>
ArgumentError |>
Expand Down

0 comments on commit 6822761

Please sign in to comment.