Compose.jl icon indicating copy to clipboard operation
Compose.jl copied to clipboard

Following instructions to use PNG backend breaks fonts...

Open ghost opened this issue 8 years ago • 12 comments

On julia 0.5, most recent release of Compose, I followed the following instructions:

Cairo and Fontconfig are necessary for the PNG backend. Run:
  Pkg.add("Cairo")
  Pkg.add("Fontconfig")
You also have to delete C:\Users\meowklaski\.julia\lib\v0.5\Compose.ji
and restart your REPL session afterwards.

in PNG(::String, ::Vararg{Any,N}) at C:\Users\meowklaski\.julia\v0.5\Compose\src\Compose.jl:182

and afterwards, any Gadfly plot that used text raised the error:

Fontconfig was unable to match font Fontconfig.Pattern(...)

I had to completely wipe and reinstall julia and my packages to remedy this...

ghost avatar Jan 16 '17 20:01 ghost

Can you please provide more context: type of OS, version of packages? afair the Fontconfig message is a warning, but it still should find a suitable default font. What problem did show up?

lobingera avatar Jan 17 '17 06:01 lobingera

I am on Windows 10, I will post my package versions at the bottom of this.

After following the following instructions:

Cairo and Fontconfig are necessary for the PNG backend. Run:
  Pkg.add("Cairo")
  Pkg.add("Fontconfig")
You also have to delete C:\Users\meowklaski\.julia\lib\v0.5\Compose.ji
and restart your REPL session afterwards.

in PNG(::String, ::Vararg{Any,N}) at C:\Users\meowklaski\.julia\v0.5\Compose\src\Compose.jl:182

These warnings print out:

INFO: Precompiling module Compose.
Fontconfig error: Cannot load default config file
INFO: Recompiling stale cache file C:\Users\meowklaski\.julia\lib\v0.5\Gadfly.ji for module Gadfly.
Fontconfig error: Cannot load default config file

Any plot that I render along with text (e.g. a plot title) throws the error:

**Fontconfig was unable to match font Fontconfig.Pattern("sans\-serif-12:familylang=en,en-us:stylelang=en,en-us:fullnamelang=en,en-us:slant=0:weight=80:width=100:pixelsize=12.5:hintstyle=3:hinting=True:verticallayout=False:autohint=False:globaladvance=True:dpi=75:scale=1:lang=en:fontversion=2147483647:embeddedbitmap=True:decorative=False:namelang=en:prgname=julia.exe:symbol=False")

 in match(::Fontconfig.Pattern, ::Bool) at C:\Users\meowklaski\.julia\v0.5\Fontconfig\src\Fontconfig.jl:124
 in match(::Fontconfig.Pattern) at C:\Users\meowklaski\.julia\v0.5\Fontconfig\src\Fontconfig.jl:109
 in match_font(::String, ::Float64) at C:\Users\meowklaski\.julia\v0.5\Compose\src\pango.jl:53
 in pango_set_font at C:\Users\meowklaski\.julia\v0.5\Compose\src\pango.jl:77 [inlined]
 in max_text_extents(::String, ::Float64, ::String, ::Vararg{String,N}) at C:\Users\meowklaski\.julia\v0.5\Compose\src\pango.jl:120
 in max_text_extents(::String, ::Measures.Length{:mm,Float64}, ::String, ::Vararg{String,N}) at C:\Users\meowklaski\.julia\v0.5\Compose\src\pango.jl:137
 in render(::Gadfly.Guide.YLabel, ::Gadfly.Theme, ::Gadfly.Aesthetics) at C:\Users\meowklaski\.julia\v0.5\Gadfly\src\guide.jl:989
 in render(::Gadfly.Guide.YLabel, ::Gadfly.Theme, ::Gadfly.Aesthetics, ::Bool) at C:\Users\meowklaski\.julia\v0.5\Gadfly\src\guide.jl:50
 in #render_prepared#111(::Bool, ::Bool, ::Function, ::Gadfly.Plot, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Array{Gadfly.StatisticElement,1},1}, ::Array{Array{Gadfly.Aesthetics,1},1}, ::Array{Array{Gadfly.Data,1},1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Array{Gadfly.GuideElement,1}) at C:\Users\meowklaski\.julia\v0.5\Gadfly\src\Gadfly.jl:895
 in render_prepared(::Gadfly.Plot, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Array{Gadfly.StatisticElement,1},1}, ::Array{Array{Gadfly.Aesthetics,1},1}, ::Array{Array{Gadfly.Data,1},1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Array{Gadfly.GuideElement,1}) at C:\Users\meowklaski\.julia\v0.5\Gadfly\src\Gadfly.jl:875
 in render(::Gadfly.Plot) at C:\Users\meowklaski\.julia\v0.5\Gadfly\src\Gadfly.jl:821
 in show at C:\Users\meowklaski\.julia\v0.5\Gadfly\src\Gadfly.jl:983 [inlined]
 in limitstringmime(::MIME{Symbol("image/svg+xml")}, ::Gadfly.Plot) at C:\Users\meowklaski\.julia\v0.5\IJulia\src\execute_request.jl:31
 in display_dict(::Gadfly.Plot) at C:\Users\meowklaski\.julia\v0.5\IJulia\src\execute_request.jl:48
 in execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\meowklaski\.julia\v0.5\IJulia\src\execute_request.jl:206
 in eventloop(::ZMQ.Socket) at C:\Users\meowklaski\.julia\v0.5\IJulia\src\eventloop.jl:8
 in (::IJulia.##13#19)() at .\task.jl:360**

5 required packages:
 - Cairo                         0.2.35
 - Fontconfig                    0.1.1
 - Gadfly                        0.5.2
 - IJulia                        1.3.3
 - RDatasets                     0.2.0
55 additional packages:
 - AxisAlgorithms                0.1.5
 - BinDeps                       0.4.5
 - BufferedStreams               0.2.1
 - Calculus                      0.1.15
 - ColorTypes                    0.2.12
 - Colors                        0.6.9
 - Compat                        0.12.0
 - Compose                       0.4.4
 - Conda                         0.4.0
 - Contour                       0.2.0
 - DataArrays                    0.3.11
 - DataFrames                    0.8.5
 - DataStructures                0.5.1
 - DiffBase                      0.0.2
 - Distances                     0.3.2
 - Distributions                 0.11.1
 - FileIO                        0.2.1
 - FixedPointNumbers             0.2.1
 - FixedSizeArrays               0.2.5
 - ForwardDiff                   0.3.3
 - GZip                          0.2.20
 - Graphics                      0.1.3
 - Hexagons                      0.0.4
 - Hiccup                        0.1.1
 - Interpolations                0.3.6
 - Iterators                     0.2.0
 - JSON                          0.8.1
 - Juno                          0.2.5
 - KernelDensity                 0.3.0
 - LegacyStrings                 0.2.0
 - LibExpat                      0.2.3
 - Libz                          0.2.2
 - LineSearches                  0.1.4
 - Loess                         0.1.0
 - MacroTools                    0.3.4
 - Measures                      0.0.3
 - Media                         0.2.4
 - NaNMath                       0.2.2
 - Nettle                        0.2.4
 - Optim                         0.7.4
 - PDMats                        0.5.2
 - PositiveFactorizations        0.0.3
 - RData                         0.0.4
 - Ratios                        0.0.4
 - Reexport                      0.0.3
 - Rmath                         0.1.6
 - SHA                           0.3.0
 - Showoff                       0.0.7
 - SortingAlgorithms             0.1.0
 - StatsBase                     0.12.0
 - StatsFuns                     0.3.1
 - URIParser                     0.1.7
 - WinRPM                        0.2.2
 - WoodburyMatrices              0.2.1
 - ZMQ                           0.4.0

ghost avatar Jan 18 '17 02:01 ghost

Do you run julia on Windows10 native, or inside this strange UNIX-like environment? (read as: how did you install julia)

lobingera avatar Jan 18 '17 09:01 lobingera

I'm running it on Windows 10 native.

ghost avatar Jan 18 '17 13:01 ghost

this is a problem on OSX-sierra as well

bjarthur avatar Feb 06 '17 17:02 bjarthur

Though I have not tried installing Cairo and Fontconfig and following the other commands, the same error is occurring for me. I am running Julia on Cinnamon Mint: Sylvia 18.3

robbobbinett avatar Jun 09 '18 01:06 robbobbinett

I'm on Linux Mint 19.2 Cinnamon and just upgraded to julia 1.3 and I'm starting to see fatal FontConfig errors that crashed julia and actually force you to quit the shell process as well.

mattcbro avatar Dec 07 '19 00:12 mattcbro

For Julia 1.3, are you on the master branch of Compose?:

]add Compose#master

Mattriks avatar Dec 07 '19 00:12 Mattriks

@Mattriks No but I'll see if it helps. I could avoid the crash by changing the order of my using commands, but I still see font problems for my plots.

I installed it but the font problems remain. In particular the negative sign is displaying as a square. Also I still get the crash if I load Plots, and InspectDR after Revise. Revise at that point is giving me warnings about Plots.jl/ is not existing directory, etc. etc.

I'm not precisely certain which modules interact with and cause the crashes. I'm also seeing an error that looks like this: /home/matt/programs/julia-1.3.0//bin/julia: symbol lookup error: /home/matt/.julia/artifacts/4eedbb6a9504ae5174298fb6e6b4da5c13fed5ce/lib/libpangoft2-1.0.so.0: undefined symbol: FcWeightFromOpenTypeDouble

mattcbro avatar Dec 07 '19 07:12 mattcbro

When you say "font problems for my plots", do you mean Gadfly plots, or something else?

Mattriks avatar Dec 08 '19 01:12 Mattriks

My back end is inspectDR. The font problems manifest as squares printing instead of a minus sign for axis labels. So for example:

using Plots
inspectdr()
y = randn(10)
x=1:10
plot(x,y, reuse=false)
savefig("badnegative.png")

Produces y-axis labels with the aforementioned problem on my rig. (Linux Mint 19.2 julia 1.3) badnegative

Unfortunately I can also crash my julia session and even the shell session, when things are sufficiently complicated. It might be a while before I can generate a minimal environment for that however.

mattcbro avatar Dec 09 '19 21:12 mattcbro

Plots.jl and Compose.jl are separate packages. Does the above issue happen with any other Plots.jl backends? If only with InspectDR.jl, then open an issue there.

Mattriks avatar Dec 09 '19 22:12 Mattriks