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

Pango problems with smaller fonts #349

Open
mwlidar opened this issue Dec 3, 2021 · 12 comments
Open

Pango problems with smaller fonts #349

mwlidar opened this issue Dec 3, 2021 · 12 comments

Comments

@mwlidar
Copy link

mwlidar commented Dec 3, 2021

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

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...

@hustf
Copy link

hustf commented Dec 6, 2021

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"

@hustf
Copy link

hustf commented Dec 6, 2021

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

@hustf
Copy link

hustf commented Dec 13, 2021

'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?

sample_pango_text2a

sample_pango_text2b

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")

@giordano
Copy link
Contributor

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.

@cormullion
Copy link
Member

FYI, your code on MacOS:

sample_pango_text2a

sample_pango_text2b

@hustf
Copy link

hustf commented Dec 14, 2021

Pango_jll is at version 1.47. Let's try the previous:

(Cairo) pkg> pin [email protected]
  [36c8627f] ↓ Pango_jll v1.47.0+0 ⇒ v1.42.4+10 ⚲
..code from above...

sample_pango_text2a
sample_pango_text2b

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?

@mwlidar
Copy link
Author

mwlidar commented Feb 8, 2022

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?

@ma-laforge
Copy link

ma-laforge commented Oct 23, 2022

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 :

image
image

@ma-laforge
Copy link

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).

@hustf
Copy link

hustf commented Oct 23, 2022

"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.

@jwahlstrand
Copy link
Contributor

Seems to be fixed by updating HarfBuzz_jll to 8.3.1. Can anyone confirm?

@hustf
Copy link

hustf commented Aug 25, 2024

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
...

code from above

sample_pango_text2a
sample_pango_text2b

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