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 1.50.12+ cannot load non-system fonts for Wesnoth 1.16 on Windows #7543

Closed
Wedge009 opened this issue Apr 16, 2023 · 34 comments
Closed
Labels
Bug Issues involving unexpected behavior. Confirmed Issues that have been successfully reproduced by at least one developer. Regression Issues that were not present in previous releases. Stable 1.16 Issues specific to the Wesnoth 1.16 maintenance branch. UI User interface issues, including both back-end and front-end issues. Upstream issue Issues that are or involve issues with libraries, tools, or platforms Wesnoth uses. Windows OS-specific issues that apply to Microsoft Windows

Comments

@Wedge009
Copy link
Member

Game and System Information

  • Version: 1.16.9
  • Downloaded from: Steam, but I expect other Windows releases to exhibit the same problem.
  • Build info: Official release build
  • OS: Windows 7 and 10

Description of the bug

Pango reports being unable to load Lato font as per logs:

(process:11320): Pango-WARNING **: 09:21:34.812: couldn't load font "Lato Not-Rotated 20", falling back to "Sans Not-Rotated 20", expect ugly output.

(process:11320): Pango-WARNING **: 09:21:34.824: couldn't load font "Lato 14", falling back to "Sans 14", expect ugly output.

(process:11320): Pango-WARNING **: 09:21:34.840: couldn't load font "Lato Not-Rotated 17", falling back to "Sans Not-Rotated 17", expect ugly output.
Checking lua scripts... ok

(process:11320): Pango-WARNING **: 09:21:35.269: couldn't load font "Lato Italic Not-Rotated 17", falling back to "Sans Italic Not-Rotated 17", expect ugly output.

(process:11320): Pango-WARNING **: 09:21:35.275: couldn't load font "Lato Bold Not-Rotated 17", falling back to "Sans Bold Not-Rotated 17", expect ugly output.

(process:11320): Pango-WARNING **: 09:21:35.307: couldn't load font "Lato Not-Rotated 16", falling back to "Sans Not-Rotated 16", expect ugly output.

(process:11320): Pango-WARNING **: 09:21:35.311: couldn't load font "Lato Not-Rotated 15", falling back to "Sans Not-Rotated 15", expect ugly output.

(process:11320): Pango-WARNING **: 09:21:35.313: couldn't load font "Lato Not-Rotated 13", falling back to "Sans Not-Rotated 13", expect ugly output.

(process:11320): Pango-WARNING **: 09:21:35.317: couldn't load font "Lato Not-Rotated 14", falling back to "Sans Not-Rotated 14", expect ugly output.

So far, I only see this issue on 1.16 releases for Windows. 1.17 doesn't appear affected, neither are Linux releases.

1.16.9 on Windows 7:
169

Steps to reproduce the behavior

Run Wesnoth 1.16.9 on Windows.

Expected behavior

1.16.8 on Windows 7:
168

1.17.15 on Windows 7:
1715

1.16.9 on Linux:
169-linux

Additional context

Don't know if it's relevant but Windows release builds includes pango 1.50.11 for Wesnoth 1.16.8 and pango 1.50.14 for both 1.16.9 and 1.17.15.

I cannot bisect this issue due to #7217.

@Wedge009 Wedge009 added Bug Issues involving unexpected behavior. Windows OS-specific issues that apply to Microsoft Windows UI User interface issues, including both back-end and front-end issues. Regression Issues that were not present in previous releases. Stable 1.16 Issues specific to the Wesnoth 1.16 maintenance branch. labels Apr 16, 2023
@Pentarctagon
Copy link
Member

Are there Lato fonts present in wesnoth's fonts/ directory?

@Wedge009
Copy link
Member Author

Yes, I did check they were all there - seems to be unchanged from 1.16.8.

@Pentarctagon
Copy link
Member

Darn, I was hoping it was that simple...

@Vultraz or maybe @knyghtmare would you be able to try bisecting this?

@Wedge009
Copy link
Member Author

Darn, I was hoping it was that simple...

Was one of the first things I checked, also hoping to find a straightforward cause...

@Wedge009 Wedge009 added the Upstream issue Issues that are or involve issues with libraries, tools, or platforms Wesnoth uses. label Apr 17, 2023
@Wedge009
Copy link
Member Author

Labelled as possible upstream issue as it seems to be pango-related. I dropped pango 1.50.11 DLLs (libpango*.dll - four files) from 1.16.8 release into 1.16.9 release and the Lato font seems to load fine.

Although this doesn't explain why Wesnoth 1.17.15 doesn't have the issue despite using the same pango version (I believe) as Wesnoth 1.16.9.

Pentarctagon added a commit to Pentarctagon/wesnoth that referenced this issue Apr 17, 2023
Should hopefully address wesnoth#7543
Pentarctagon added a commit to Pentarctagon/wesnoth that referenced this issue Apr 17, 2023
Should hopefully address wesnoth#7543
Pentarctagon added a commit to Pentarctagon/wesnoth that referenced this issue Apr 17, 2023
Should hopefully address wesnoth#7543
@knyghtmare
Copy link
Member

would you be able to try bisecting this?

What am I supposed to look for?

Should I use 1.16.8 as a starting point and the latest 1.16.x commit as the end point?

@Wedge009
Copy link
Member Author

Wedge009 commented Apr 17, 2023

1.16.8 and 1.16.9 should suffice. 1.16.8 'good', 1.16.9 'bad'.

But if the underlying issue is due to changes in pango, a bisect might not get us anywhere.

@knyghtmare
Copy link
Member

image

I cannot seem to switch to 1.16.9+dev branch on Github Desktop. This was working fine...What is this?

@gfgtdf
Copy link
Contributor

gfgtdf commented Apr 19, 2023

It would be nice if this war reported upstream, if it's a recent change someone at pango that knows the ide might still be around to fix it

@knyghtmare knyghtmare added the Confirmed Issues that have been successfully reproduced by at least one developer. label Apr 19, 2023
@Pentarctagon
Copy link
Member

@knyghtmare I guess it doesn't like the lua modules directory not existing for 1.16 for some reason. I don't know why though - a simple git checkout 1.16 on the command line works fine.

@knyghtmare
Copy link
Member

warning: unable to rmdir 'src/modules/lua': Directory not empty
Updating files: 100% (12450/12450), done.
Switched to branch '1.16'
Your branch is up to date with 'origin/1.16'.

It worked but doesn't show in the Github desktop client that it worked

@Zireael07
Copy link

Github desktop client has always been buggy for me. Try another free GUI git client - GitKraken and SourceTree are both good in my experience

@gfgtdf
Copy link
Contributor

gfgtdf commented Apr 19, 2023

So if i understood the comment in #7544 (comment) correctly we 'fixed' the 1.16.9 windows steam/download release by using oder dll versions? And this is 'only' about self builds and 1.16.10+ now?

@Pentarctagon
Copy link
Member

Correct.

@Pentarctagon Pentarctagon changed the title Pango cannot load Lato font in 1.16.9 Windows releases Pango cannot load Lato font on Windows with newer pango dlls Apr 20, 2023
@Wedge009
Copy link
Member Author

Wedge009 commented Jul 14, 2023

It appears that with the way 1.16 uses Pango - without fontconfig that's currently in master - something changed in Pango between 1.50.11 and 1.50.14 such that on Windows platforms it will only load a font if it's available in the Windows system pool of fonts. I confirmed this by installing the Lato fonts on my system, and re-confirmed the problem after uninstalling the fonts.

I found this from browsing various reports of the same issue for projects that depend on Pango, not Pango itself. Looking at Pango's change log, there doesn't appear to be anything directly associated with this change in behaviour.

@Pentarctagon
Copy link
Member

So this is potentially an upstream issue, in that case?

@Wedge009
Copy link
Member Author

Perhaps a change in how downstream users are expected to use it.

Wedge009 added a commit to Wedge009/wesnoth that referenced this issue Jul 14, 2023
This updates to pango 1.50.14 (from 1.50.12) which resolves wesnoth#7217 (but introduces wesnoth#7543).
@Pentarctagon
Copy link
Member

Did you find anything indicating what that new expected usage is? If not, it would probably be worth it to open an issue on the pango gitlab asking if it's intentional and if it is then what's the new expected way to handle this.

@Wedge009
Copy link
Member Author

Wedge009 commented Jul 14, 2023

Actually, I'm not even sure that it's necessarily a new problem. I don't really know how Pango, Cairo, fontconfig, and Wesnoth are all supposed to interact. But reading through various issues like the following seems to suggest that it's an expectation to either use fontconfig to set-up the fonts or have the fonts installed and available system-wide:

Automattic/node-canvas#1608
lovell/sharp#1162 (comment)
shoes/shoes3#48

Oh, and I think my GitLab account expired - I gave up on trying to use the platform because of some requirement that the GitLab account name and the name configured in my local Git be the same for MRs. Or maybe that was specific to the project, I can't remember now.

Wedge009 added a commit that referenced this issue Jul 14, 2023
This updates to pango 1.50.14 (from 1.50.12) which resolves #7217 (but introduces #7543).
@Pentarctagon
Copy link
Member

Pentarctagon commented Jul 14, 2023

Reading through those, it sounds like there are a couple options to try and get some additional information:

Otherwise I suppose the question would just be "how are we supposed to be loading game-specific fonts that aren't installed or system-wide?"

@gfgtdf
Copy link
Contributor

gfgtdf commented Jul 14, 2023

But reading through various issues...

All of these issues are much older then this bug the pango version that changed this is from 2023 or late 2022, and even if our method is not listed there it doesn'tean that it's not supported.

I really think the only way to get clarity on this issue is to file an upstream bug report, ideally with a simple example code.

@Wedge009
Copy link
Member Author

All of these issues are much older then (sic) this bug the pango version that changed this is from 2023 or late 2022, and even if our method is not listed there it doesn'tean (sic) that it's not supported.

I noted that as well. As a quick test, I tried libpango 1.50.14 (my distribution normally uses 1.50.6) on Linux and confirmed I don't already have Lato installed as a system font - no apparent issues on either 1.17.18+dev nor 1.16.9 release nor 1.16.10+dev. Just confirming: Windows is the only platform where Wesnoth doesn't use fontconfig (and only for 1.16)?

@Pentarctagon
Copy link
Member

Correct.

@Wedge009
Copy link
Member Author

Wedge009 commented Jul 15, 2023

After some more testing with vcpkg's builds of Pango and peeking into the Pango source code and git blame records, I'm fairly confident this is caused by https://gitlab.gnome.org/GNOME/pango/-/commit/5bc16f7896ba3eb5b37ffdb03f28c646aad5889e. There's an issue already open for this: https://gitlab.gnome.org/GNOME/pango/-/issues/720

(In summary, it appears to be caused by a switch to DirectWrite that broke Windows GDI support. Wesnoth uses the latter.)

This doesn't help the release version of Wesnoth, since that doesn't use MSVC, but while this is an issue I can work around it by adding the following to vcpkg.json:

  "overrides": [
    {
      "name": "pango",
      "version": "1.50.11"
    }
  ]

@Wedge009
Copy link
Member Author

Wedge009 commented Jul 15, 2023

@loonycyborg Do you need to be aware of this? Perhaps we can hold to libpango 1.50.11 for Windows releases for the time being?

@Wedge009 Wedge009 changed the title Pango cannot load Lato font on Windows with newer pango dlls Pango 1.50.12+ cannot load non-system fonts for Wesnoth 1.16 on Windows Jul 19, 2023
@Wedge009
Copy link
Member Author

Wedge009 commented Jul 19, 2023

Advice from Pango developers seems to be to stay on libpango 1.50.11 until they replace the now-missing GDI functionality in a 'PangoWin32 API'. (Or use fontconfig, which we already established in #7544 cannot be done.) DirectWrite - which seems to ignore non-system installed fonts - replaced GDI usage in libpango 1.50.12.

https://gitlab.gnome.org/GNOME/pango/-/issues/720#note_1794746

Additionally, it appears any support for non-system fonts with newer Pango would be for Windows 10 first, older Windows second (if at all).

@gfgtdf
Copy link
Contributor

gfgtdf commented Jul 20, 2023

Nice, thx for finding this.

@loonycyborg
Copy link
Member

I guess we would have to make a separate docker image for msys2+windows build then, with downgraded pango.

@Konrad22
Copy link
Contributor

Konrad22 commented Aug 6, 2023

Hey, it seems the bug made it into the 1.16.10 release. :/

@Pentarctagon
Copy link
Member

Should be fixed for 1.16.10 now.

loonycyborg added a commit that referenced this issue Aug 6, 2023
Wedge009 added a commit to Wedge009/wesnoth that referenced this issue Nov 4, 2023
…hen fontconfig is not used.

Works around wesnoth#7543 for developers but does not resolve it as the official Wesnoth Windows builds do not use MSVC or vcpkg.
Only necessary for 1.16 because 1.17+ uses fontconfig.
Pentarctagon pushed a commit that referenced this issue Nov 18, 2023
…hen fontconfig is not used.

Works around #7543 for developers but does not resolve it as the official Wesnoth Windows builds do not use MSVC or vcpkg.
Only necessary for 1.16 because 1.17+ uses fontconfig.
@fanc999-1
Copy link

fanc999-1 commented Dec 14, 2023

Hi,

This issue is raised as Pango/Cairo is transitioning to DirectWrite, so AddFontResourceEx() with FR_PRIVATE will be affected when using PangoWin32.

Related upstream items:
https://gitlab.gnome.org/GNOME/pango/-/issues/720
https://gitlab.gnome.org/GNOME/pango/-/merge_requests/700
https://gitlab.gnome.org/GNOME/pango/-/merge_requests/707

Current upstream Pango has a new API that works for Windows 10 and later that added support using an API adding non-installed fonts into the PangoWin32FontMap, and the version for Windows 7/8.x is under review/progress.

With blessings, and cheers!

@Pentarctagon
Copy link
Member

Is there documentation for this?

@Wedge009
Copy link
Member Author

I suppose this can be closed once 1.18 releases

@Wedge009
Copy link
Member Author

Not an issue with 1.18.x release.

@Wedge009 Wedge009 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues involving unexpected behavior. Confirmed Issues that have been successfully reproduced by at least one developer. Regression Issues that were not present in previous releases. Stable 1.16 Issues specific to the Wesnoth 1.16 maintenance branch. UI User interface issues, including both back-end and front-end issues. Upstream issue Issues that are or involve issues with libraries, tools, or platforms Wesnoth uses. Windows OS-specific issues that apply to Microsoft Windows
Projects
None yet
Development

No branches or pull requests

8 participants