Get fontsize in Luxor

How do I get the font size that has been set with the setfont function?
The function get_fontsize gives me the size that has been set with the fontsize function.

I don’t know. If there’s an answer, it will be in the Cairo.jl package, which I don’t understand.

Some clues to start you off:

Luxor.setfont(f, n) calls Cairo::

function set_font_face(ctx::CairoContext, str::AbstractString)
    fontdesc = ccall((:pango_font_description_from_string,libpango),
                     Ptr{Nothing}, (Ptr{UInt8},), String(str))
    ccall((:pango_layout_set_font_description,libpango), Nothing,
          (Ptr{Nothing},Ptr{Nothing}), ctx.layout, fontdesc)
    ccall((:pango_font_description_free,libpango), Nothing,
          (Ptr{Nothing},), fontdesc)

Luxor.fontface(f) calls Cairo:

function select_font_face(ctx::CairoContext,family::AbstractString,slant,weight)
    ccall((:cairo_select_font_face, libcairo),
          Nothing, (Ptr{Nothing}, Ptr{UInt8},
                 font_slant_t, font_weight_t),
          ctx.ptr, String(family),
          slant, weight)

Thank you. That is a good starting point.

Oh, I also found this function:


which looks like it returns some kind of Pango layout dimensions:

julia-1.10> setfont("", 30)

julia-1.10> w, h = Luxor.Cairo.get_layout_size(currentdrawing().cr)
2-element Vector{Int32}:
1 Like