Open mwlidar opened 2 years ago
It seems this affects all font scaling in Pango. If that is the case, a new version ought to be coming soon.
text(cr,16.0,104.0,"Text<b>Bold</b><i>Italic</i><big>super-2</big>",markup=true)
Confirmed on Windows, Julia 1.7.0.
julia> libpango_version = unsafe_string(
ccall((:pango_version_string,Cairo.libpango),Cstring,()) )
"1.47.0"
Another example, indirectly to Cairo using Luxor. Font scaling is broken (with my setup). It would be nice to know if this is an issue with the windows version, only?
using Luxor
Drawing(640, 480, "temp.svg")
settext("Before, ϕ", Point(100.0, 150.0))
setfont("Georgia Bold", 65.0)
settext("Before, ϕ", Point(100.0, 200.0))
finish()
preview()
In case issues get posted at Luxor.jl, for info: @cormullion
'One size per font family per session' is close to describing the issue here.
It's daunting that the error remains until the next Julia session. Also, is this an issue on Windows only?
using Cairo
c = CairoRGBSurface(256,256);
cr = CairoContext(c);
fill(cr);
set_source_rgb(cr,0.8,0.8,0.8); # light gray
set_font_face(cr, "Sans 16.0")
text(cr,40.0,60.0,"Sans 16.0")
text(cr,40.0,80.0,"Sans 16<small>small</small>",markup=true)
set_font_face(cr, "Sans 10.0")
text(cr,40.0,100.0,"Sans 10")
set_font_face(cr, "Sans 16")
text(cr,40.0,120.0,"Sans 16 again")
set_font_face(cr, "Serif 15.0")
text(cr,40.0,140.0,"Serif 15.0")
set_font_face(cr, "Serif 16.0")
text(cr,40.0,160.0,"Serif 16.0")
set_font_face(cr, "Cambria 12.0")
text(cr,40.0,180.0,"Cambria 12.0")
set_font_face(cr, "Cambria 15.0")
text(cr,40.0,200.0,"Cambria 15.0")
set_font_face(cr, "Serif 12.0")
text(cr,40.0,220.0,"Serif 12.0")
set_font_face(cr, "Serif 15.0")
text(cr,40.0,240.0,"Serif 15.0")
set_font_face(cr, "Sans 15.0")
text(cr,40.0,260.0,"Sans 15.0")
write_to_png(c,"sample_pango_text2a.png")
c = CairoRGBSurface(256,256);
cr = CairoContext(c);
fill(cr);
set_source_rgb(cr,0.8,0.8,0.8); # light gray
set_font_face(cr, "Sans 12.0")
text(cr,40.0,60.0,"Sans 12")
set_font_face(cr, "Sans 16")
text(cr,40.0,80.0,"Sans 16 still special")
set_font_face(cr, "Cambria 15.0")
text(cr,40.0,100.0,"One size family quota!")
set_font_face(cr, "Cambria 12.0")
text(cr,40.0,120.0,"Cambria 12.0")
write_to_png(c,"sample_pango_text2b.png")
Must have to do with the lates FreeType package updates.
What FreeType package are you talking about? None of FreeType.jl
(which isn't used by this package) and FreeType2_jll.jl
has been touched in the last 7 months.
FYI, your code on MacOS:
Pango_jll is at version 1.47. Let's try the previous:
(Cairo) pkg> pin Pango_jll@v1.42.4
[36c8627f] ↓ Pango_jll v1.47.0+0 ⇒ v1.42.4+10 ⚲
..code from above...
We just culpritted Pango. How does one go about requesting an updated Pango_jll compilation? I found no relevant issues, but one can hope this is fixed by now?
Now Pango_jll is at version 1.50.3 but the problem is still there for me (on Windows with Julia 1.6.5 and 1.7.2). Pinning Pango_jll to 1.42.4 still solves the problem. Is this a general issue for Windows are is this biting only a few, depending on their installation?
Problem persists with Julia v1.8.2 & Pango_jll v1.50.9 on Windows 10.
Though the font sizes that cause issues are different than those reported by @hustf :
Downgrading Pango_jll 1.50.3 --> v1.42 still worked to get fonts rendered correctly on my system (as @hustf mentioned):
⌃ [77ec8976] ↓ GTK3_jll v3.24.31+0 ⇒ v3.24.29+0
[57eb2189] + Libcroco_jll v0.6.13+2
⌃ [925c91fb] ↓ Librsvg_jll v2.52.4+0 ⇒ v2.42.2+3
⌃ [36c8627f] ↓ Pango_jll v1.50.9+0 ⇒ v1.42.4+10
Though downgrading Pango downgrades 2 dependent packages (and adds Libcroco_jll).
"Downgrading" dependencies seems the best choice right now, just from looking at the maintenance history. Or are jlls upgraded by some external procedure?
The whole jll system is a mystery to me, but I encourage somebody with the skills or curiosity to step in here, too, to merge PRs and the like.
Cairo on Windows has more than a few uses, though the dependencies usually get the credit.
Seems to be fixed by updating HarfBuzz_jll to 8.3.1. Can anyone confirm?
I confirm. And send my best regards!
In Windows, a fresh environment, Julia 1.10.4:
´´´ (@Cairo) pkg> add Cairo ... [2e76f6c2] + HarfBuzz_jll v8.3.1+0 ...
Since a few day smaller fonts (below 16pt) are not rendered correctly any more. Most easyly to see with the sample_pango_text.jl example:![sample_pango_text](https://user-images.githubusercontent.com/87604697/144637779-ffaf0719-d409-4747-a06e-be435bc80f32.png)
This is with Julia 1.6.4 and Cairo 1.0.5. Must have to do with the lates FreeType package updates. But I wasn't able to narrow this down further...