Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Cairo compatibility #360

Merged
merged 10 commits into from
Nov 2, 2019
Merged

Conversation

CiaranOMara
Copy link
Contributor

@CiaranOMara CiaranOMara commented Oct 7, 2019

This pull request sets Cairo compatibility to 0.7 and addresses associated deprecated bindings.

This request closes #357.

@codecov-io
Copy link

codecov-io commented Oct 7, 2019

Codecov Report

Merging #360 into master will increase coverage by 0.94%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #360      +/-   ##
==========================================
+ Coverage   39.84%   40.79%   +0.94%     
==========================================
  Files          18       18              
  Lines        3059     3057       -2     
==========================================
+ Hits         1219     1247      +28     
+ Misses       1840     1810      -30
Impacted Files Coverage Δ
src/pango.jl 21.66% <ø> (ø) ⬆️
src/cairo_backends.jl 61.11% <80%> (+5.58%) ⬆️
src/svg.jl 71.12% <0%> (+1.08%) ⬆️
src/property.jl 24.53% <0%> (+2.93%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91e6172...f525390. Read the comment docs.

@Mattriks
Copy link
Member

Mattriks commented Oct 8, 2019

Have you tested this with a julia unicode example? e.g.

# the string is \ita \itb etc
img = compose(context(), 
    text(0.5, 0.5, "𝑎 𝑏 𝑐 𝑑 𝑒 𝑓", hcenter, vcenter), font("Segoe UI"), fontsize(20pt) )
draw(PNG(), img)

This works for me on Cairo 0.6, but only shows boxes with Cairo 0.7 (on windows 10 OS).

@CiaranOMara
Copy link
Contributor Author

CiaranOMara commented Oct 8, 2019

That type of example does not appear to be included in a current integration test.

Below is the output of what I got for the above example with Cairo v0.7 on macOS 10.14.6. I can't get Cairo v0.6 to work.

julia> using Compose
julia> import Cairo, Fontconfig
julia> img = compose(context(), text(0.5, 0.5, "𝑎 𝑏 𝑐 𝑑 𝑒 𝑓", hcenter, vcenter), font("Segoe UI"), fontsize(20pt) )
Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), nothing, nothing, nothing, nothing, List([]), List([Compose.Form{Compose.TextPrimitive{Tuple{Measures.Length{:cx,Float64},Measures.Length{:cy,Float64}},Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}},Tuple{Measures.Length{:mm,Float64},Measures.Length{:mm,Float64}}}}(Compose.TextPrimitive{Tuple{Measures.Length{:cx,Float64},Measures.Length{:cy,Float64}},Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}},Tuple{Measures.Length{:mm,Float64},Measures.Length{:mm,Float64}}}[Compose.TextPrimitive{Tuple{Measures.Length{:cx,Float64},Measures.Length{:cy,Float64}},Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}},Tuple{Measures.Length{:mm,Float64},Measures.Length{:mm,Float64}}}((0.5cx, 0.5cy), "𝑎 𝑏 𝑐 𝑑 𝑒 𝑓", Compose.HCenter(), Compose.VCenter(), Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}(0.0, (0.5w, 0.5h)), (0.0mm, 0.0mm))], Symbol(""))]), List([Compose.Property{Compose.FontSizePrimitive}(Compose.FontSizePrimitive[Compose.FontSizePrimitive(7.055555555555555mm)]), Compose.Property{Compose.FontPrimitive}(Compose.FontPrimitive[Compose.FontPrimitive("Segoe UI")])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol(""))

julia> draw(PNG(), img)
Compose.Image{Compose.PNGBackend}(IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=2758, maxsize=Inf, ptr=2759, mark=-1), Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Cairo.CairoContext(Ptr{Nothing} @0x0000000000000000, Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Ptr{Nothing} @0x00007fd12118b2e0), 534.5059133378628, 377.9527559055118, RGBA{Float64}(0.0,0.0,0.0,0.0), RGBA{Float64}(0.0,0.0,0.0,1.0), Float64[], LineCapButt(), Compose.LineJoinMiter(), true, 0.3mm, 3.880555555555555mm, "Helvetica Neue,Helvetica,Arial,sans", nothing, false, Compose.ImagePropertyState[], Compose.ImagePropertyFrame[], Dict{Type,Union{Nothing, Compose.Property}}(), true, false, nothing, true, true, 3.7795275590551185, nothing, nothing)
false

julia> draw(PNG("tmp.png"), img)

tmp

However, plain text is fine.

julia> img_plain = compose(context(), text(0.5, 0.5, "plain text", hcenter, vcenter), font("Segoe UI"), fontsize(20pt) )
Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), nothing, nothing, nothing, nothing, List([]), List([Compose.Form{Compose.TextPrimitive{Tuple{Measures.Length{:cx,Float64},Measures.Length{:cy,Float64}},Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}},Tuple{Measures.Length{:mm,Float64},Measures.Length{:mm,Float64}}}}(Compose.TextPrimitive{Tuple{Measures.Length{:cx,Float64},Measures.Length{:cy,Float64}},Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}},Tuple{Measures.Length{:mm,Float64},Measures.Length{:mm,Float64}}}[Compose.TextPrimitive{Tuple{Measures.Length{:cx,Float64},Measures.Length{:cy,Float64}},Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}},Tuple{Measures.Length{:mm,Float64},Measures.Length{:mm,Float64}}}((0.5cx, 0.5cy), "plain text", Compose.HCenter(), Compose.VCenter(), Rotation{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}(0.0, (0.5w, 0.5h)), (0.0mm, 0.0mm))], Symbol(""))]), List([Compose.Property{Compose.FontSizePrimitive}(Compose.FontSizePrimitive[Compose.FontSizePrimitive(7.055555555555555mm)]), Compose.Property{Compose.FontPrimitive}(Compose.FontPrimitive[Compose.FontPrimitive("Segoe UI")])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol(""))

julia> draw(PNG(), img_plain)
Compose.Image{Compose.PNGBackend}(IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=2485, maxsize=Inf, ptr=2486, mark=-1), Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Cairo.CairoContext(Ptr{Nothing} @0x0000000000000000, Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Ptr{Nothing} @0x00007fd12118b5a0), 534.5059133378628, 377.9527559055118, RGBA{Float64}(0.0,0.0,0.0,0.0), RGBA{Float64}(0.0,0.0,0.0,1.0), Float64[], LineCapButt(), Compose.LineJoinMiter(), true, 0.3mm, 3.880555555555555mm, "Helvetica Neue,Helvetica,Arial,sans", nothing, false, Compose.ImagePropertyState[], Compose.ImagePropertyFrame[], Dict{Type,Union{Nothing, Compose.Property}}(), true, false, nothing, true, true, 3.7795275590551185, nothing, nothing)
false

julia> draw(PNG("plain.png"), img_plain)

plain

@CiaranOMara
Copy link
Contributor Author

CiaranOMara commented Oct 8, 2019

Your example works on Linux 5.3.5-arch1-1-ARCH x86_64.

tmp

@CiaranOMara CiaranOMara force-pushed the develop branch 2 times, most recently from b7c7f5c to f796e4a Compare October 8, 2019 11:10
@CiaranOMara
Copy link
Contributor Author

@Mattriks, your unicode example works for me on macOS 10.15 with 076581d and JuliaGraphics/Fontconfig.jl#25, does this combination work for you on Windows 10?

@CiaranOMara
Copy link
Contributor Author

Waiting for Fontconfig v0.3 to be registered.

@CiaranOMara
Copy link
Contributor Author

Tests failed for Julia v0.7. Fontconfig v0.3 has a compatibility requirement of Julia ≥ v1. Dropping support for Julia v0.7 will allow a quick transition to a Binary Provider solution... how do you want to approach this?

@tlnagy
Copy link
Member

tlnagy commented Oct 14, 2019

I think we're probably going to go ahead and drop 0.7 support given the difficulties we're running into with testing on it. We'll make a decision soon.

ref: GiovineItalia/Gadfly.jl#1328

@bjarthur
Copy link
Member

0.7 has been dropped. #362 . redo CI and let's see if test pass now.

test/misc.jl Outdated Show resolved Hide resolved
CiaranOMara added a commit to CiaranOMara/Compose.jl that referenced this pull request Oct 21, 2019
.travis.yml Outdated Show resolved Hide resolved
Project.toml Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cairo 0.7
5 participants