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

"pangolayout not defined" in Ubuntu #56

Closed
kosiakk opened this issue Jun 8, 2014 · 5 comments
Closed

"pangolayout not defined" in Ubuntu #56

kosiakk opened this issue Jun 8, 2014 · 5 comments

Comments

@kosiakk
Copy link

kosiakk commented Jun 8, 2014

I have a fresh installation of Ubuntu 14.04, with julia version 0.2.1.
I tried to reproduce those magnificent plot from Gadfly demo

using Gadfly
plot(x=rand(10), y=rand(10))

but I get an error (both when run from IPython and Julia terminal)

pangolayout not defined
 in text_extents at /home/sasha/.julia/v0.2/Compose/src/pango.jl:103
 in text_extents at /home/sasha/.julia/v0.2/Compose/src/pango.jl:120
 in render at /home/sasha/.julia/v0.2/Gadfly/src/guide.jl:451
 in render_prepared at /home/sasha/.julia/v0.2/Gadfly/src/Gadfly.jl:707
 in render at /home/sasha/.julia/v0.2/Gadfly/src/Gadfly.jl:656
 in writemime at /home/sasha/.julia/v0.2/Gadfly/src/Gadfly.jl:755
 in sprint at io.jl:434
 in display_dict at /home/sasha/.julia/v0.2/IJulia/src/execute_request.jl:27

Apparently, c-libraries themselves are installed and Julia bindings are too.
Am I doing something incorrectly?

> Pkg.status()
Required packages:
 - Cairo                         0.2.13
 - Gadfly                        0.2.9
 - IJulia                        0.1.11
 - PyPlot                        1.2.7
Additional packages:
 - BinDeps                       0.2.12
 - Blocks                        0.0.4
 - Codecs                        0.1.0
 - Color                         0.2.10
 - Compose                       0.1.29
 - DataArrays                    0.0.3
 - DataFrames                    0.4.3
 - DataStructures                0.2.14
 - Datetime                      0.1.3
 - Distance                      0.2.6
 - Distributions                 0.3.0
 - GZip                          0.2.12
 - Hexagons                      0.0.1
 - Iterators                     0.1.2
 - JSON                          0.3.5
 - Loess                         0.0.2
 - Nettle                        0.1.3
 - NumericExtensions             0.3.6
 - PyCall                        0.4.6
 - REPLCompletions               0.0.1
 - SortingAlgorithms             0.0.1
 - StatsBase                     0.3.8
 - URIParser                     0.0.2
 - ZMQ                           0.1.11
@al-Khwarizmi
Copy link

There are some lines of code missing from pango.jl (which used to be there before the last couple of changes). Replacing lines 47-58 by the following did the job for me:

# Backend used to compute text extents.
ccall((:g_type_init, "libgobject-2.0"), Void, ())
const pango_cairo_fm = ccall((:pango_cairo_font_map_new, libpangocairo),
                             Ptr{Void}, ())
const pango_cairo_ctx = ccall((:pango_font_map_create_context, libpango),
                              Ptr{Void}, (Ptr{Void},), pango_cairo_fm)


# Thin wrapper for a pango_layout object.
type PangoLayout
    layout::Ptr{Void}

    function PangoLayout()
        layout = ccall((:pango_layout_new, libpango),
                       Ptr{Void}, (Ptr{Void},), pango_cairo_ctx)
        # TODO: finalizer?

        new(layout)
    end
end


# We can get away with just one layout.
const pangolayout = PangoLayout()

@jimmyfigueroa
Copy link

Thank you al-Khwarizmi .. Indeed this solves the problem, in my case it was only a matter of adding the "const pangolayout = PangoLayout()" and that did the trick. Thank you so much. Jimmy.

@dcjones
Copy link
Collaborator

dcjones commented Jun 22, 2014

This should be fixed after updating. Sorry to temporarily break 0.2 support like this.

@dcjones dcjones closed this as completed Jun 22, 2014
@kilianbreathnach
Copy link

Sorry to be reviving this thread but I seem to be getting this error after recently updating my setup. I am using master branch Gadfly and master branch of Compose.jl in order to run on julia v0.7 and I get the same error "pangolayout not defined" which then goes away when I add "const pangolayout = PangoLayout()" to pango.jl

@bjarthur
Copy link
Member

you need to using Fontconfig after using Compose. but it's currently broken. see #299

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

No branches or pull requests

6 participants