-
Notifications
You must be signed in to change notification settings - Fork 81
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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). |
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) 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) |
b7c7f5c
to
f796e4a
Compare
@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? |
Waiting for Fontconfig v0.3 to be registered. |
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? |
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. |
0.7 has been dropped. #362 . redo CI and let's see if test pass now. |
dee526d
to
b7b4730
Compare
0ed36ed
to
7b9979c
Compare
Binary Provider should be doing all the work.
Tested with https://github.com/giordano/Fontconfig.jl/tree/bb, which is yet to be merged.
This pull request sets Cairo compatibility to 0.7 and addresses associated deprecated bindings.
This request closes #357.