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

Fix automatic font download on Windows #57844

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

nyalldawson
Copy link
Collaborator

No description provided.

@nyalldawson
Copy link
Collaborator Author

@agiudiceandrea can you test this build please?

Copy link

github-actions bot commented Jun 24, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 2fd8813)

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jun 24, 2024

@nyalldawson, unfortunately the issue still occurs using this MinGW64 Windows Build on my Windows 10 system.

Same behavior and error messages except for the one in the tab "General" of the Log Messages panel which is the following one using this build:
WARNING Error opening zip archive: 'C:/Users/Andrea/Downloads/QGIS-Portable/bin/mbyYAa.ttf' (Error code: 19)

while it is the following one using QGIS 3.38.0 or a previous MinGW64 Windows Build
WARNING Error opening zip archive: 'C:/Users/Andrea/AppData/Local/Temp/QGIS3.Ogbhun' (Error code: 19)

The connection log seems the same as before.

{
   "Bytes Received": 0,
   "Bytes Total": 0,
   "Cache (control)": "Load from cache if available, otherwise load from network",
   "Cache (save)": "Can store result in cache",
   "Headers": {
     "User-Agent": "Mozilla/5.0 QGIS/33900/Windows 10 Version 1903"
   },
   "ID": "src/core/textrenderer/qgsfontmanager.cpp:2104 (run)",
   "Initiator": "QgsFontDownloadTask",
   "Operation": "GET",
   "Replies": 1,
   "Reply": {
     "Cache (result)": "Read from network",
     "Headers": {
       "Access-Control-Allow-Origin": "",
       "Cache-Control": "no-cache",
       "Content-Length": "0",
       "Content-Security-Policy": "default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com api.githubcopilot.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com/v1/engines/github-completion/completions *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/",
       "Content-Type": "text/html; charset=utf-8",
       "Date": "Mon, 24 Jun 2024 05:18:27 GMT",
       "Location": "https://raw.githubusercontent.com/google/fonts/main/ofl/opensans/OpenSans%5Bwdth%2Cwght%5D.ttf",
       "Referrer-Policy": "no-referrer-when-downgrade",
       "Server": "GitHub.com",
       "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
       "Vary": "X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With",
       "X-Content-Type-Options": "nosniff",
       "X-Frame-Options": "deny",
       "X-GitHub-Request-Id": "DC84:C1F32:79583F7:7C42406:667901A3",
       "X-XSS-Protection": "0"
     },
     "Status": "302"
   },
   "Thread": "0x000001fa1d6b46c0",
   "Total time (ms)": 604,
   "URL": "https://github.com/google/fonts/raw/main/ofl/opensans/OpenSans[wdth,wght].ttf"
 },
 {
   "Bytes Received": 0,
   "Bytes Total": 532636,
   "Cache (control)": "Load from cache if available, otherwise load from network",
   "Cache (save)": "Can store result in cache",
   "Headers": {
     "User-Agent": "Mozilla/5.0 QGIS/33900/Windows 10 Version 1903"
   },
   "Initiator": "unknown",
   "Operation": "GET",
   "Replies": 2,
   "Reply": {
     "Cache (result)": "Used entry from cache",
     "Headers": {
       "Accept-Ranges": "bytes",
       "Access-Control-Allow-Origin": "*",
       "Content-Length": "532636",
       "Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; sandbox",
       "Content-Type": "application/octet-stream",
       "Cross-Origin-Resource-Policy": "cross-origin",
       "Date": "Mon, 24 Jun 2024 05:14:51 GMT",
       "ETag": "W/\"43cfa2ae7e736f491a167297b214d2e2bd8ae764313cdb2553062beb70a63dbc\"",
       "Expires": "Mon, 24 Jun 2024 05:19:52 GMT",
       "Source-Age": "0",
       "Strict-Transport-Security": "max-age=31536000",
       "Vary": "Authorization,Accept-Encoding,Origin",
       "Via": "1.1 varnish",
       "X-Cache": "HIT",
       "X-Cache-Hits": "0",
       "X-Content-Type-Options": "nosniff",
       "X-Fastly-Request-ID": "284afb8cd5c5677a6df346c54154eb7365ea604c",
       "X-Frame-Options": "deny",
       "X-GitHub-Request-Id": "A470:3EDA21:163C47A:1758176:6678B2B3",
       "X-Served-By": "cache-lin1730061-LIN",
       "X-Timer": "S1719206092.931865,VS0,VE147",
       "X-XSS-Protection": "1; mode=block"
     },
     "Status": "200"
   },
   "Thread": "0x000001fa1d6b46c0",
   "Total time (ms)": 5,
   "URL": "https://raw.githubusercontent.com/google/fonts/main/ofl/opensans/OpenSans%5Bwdth%2Cwght%5D.ttf"
 },
 {
   "Bytes Received": 0,
   "Bytes Total": 0,
   "Cache (control)": "Load from cache if available, otherwise load from network",
   "Cache (save)": "Can store result in cache",
   "Headers": {
     "User-Agent": "Mozilla/5.0 QGIS/33900/Windows 10 Version 1903"
   },
   "ID": "src/core/textrenderer/qgsfontmanager.cpp:2104 (run)",
   "Initiator": "QgsFontDownloadTask",
   "Operation": "GET",
   "Replies": 1,
   "Reply": {
     "Cache (result)": "Read from network",
     "Headers": {
       "Access-Control-Allow-Origin": "",
       "Cache-Control": "no-cache",
       "Content-Length": "0",
       "Content-Security-Policy": "default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com api.githubcopilot.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com/v1/engines/github-completion/completions *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/",
       "Content-Type": "text/html; charset=utf-8",
       "Date": "Mon, 24 Jun 2024 05:18:28 GMT",
       "Location": "https://raw.githubusercontent.com/google/fonts/main/ofl/opensans/OpenSans-Italic%5Bwdth%2Cwght%5D.ttf",
       "Referrer-Policy": "no-referrer-when-downgrade",
       "Server": "GitHub.com",
       "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
       "Vary": "X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With",
       "X-Content-Type-Options": "nosniff",
       "X-Frame-Options": "deny",
       "X-GitHub-Request-Id": "DC84:C1F32:7958566:7C4259E:667901A3",
       "X-XSS-Protection": "0"
     },
     "Status": "302"
   },
   "Thread": "0x000001fa1d6b46c0",
   "Total time (ms)": 490,
   "URL": "https://github.com/google/fonts/raw/main/ofl/opensans/OpenSans-Italic[wdth,wght].ttf"
 },
 {
   "Bytes Received": 0,
   "Bytes Total": 583992,
   "Cache (control)": "Load from cache if available, otherwise load from network",
   "Cache (save)": "Can store result in cache",
   "Headers": {
     "User-Agent": "Mozilla/5.0 QGIS/33900/Windows 10 Version 1903"
   },
   "Initiator": "unknown",
   "Operation": "GET",
   "Replies": 2,
   "Reply": {
     "Cache (result)": "Used entry from cache",
     "Headers": {
       "Accept-Ranges": "bytes",
       "Access-Control-Allow-Origin": "*",
       "Content-Length": "583992",
       "Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; sandbox",
       "Content-Type": "application/octet-stream",
       "Cross-Origin-Resource-Policy": "cross-origin",
       "Date": "Mon, 24 Jun 2024 05:14:52 GMT",
       "ETag": "W/\"979e5b9b35593a390672afe0163c0c5a9f91f04285006fcb10e391cace5195c6\"",
       "Expires": "Mon, 24 Jun 2024 05:19:52 GMT",
       "Source-Age": "0",
       "Strict-Transport-Security": "max-age=31536000",
       "Vary": "Authorization,Accept-Encoding,Origin",
       "Via": "1.1 varnish",
       "X-Cache": "HIT",
       "X-Cache-Hits": "0",
       "X-Content-Type-Options": "nosniff",
       "X-Fastly-Request-ID": "c8b53be74f7c740479ff9757afb9aff36224aa43",
       "X-Frame-Options": "deny",
       "X-GitHub-Request-Id": "FD4F:1C9D7F:F384A0:FF09B1:6678B2B4",
       "X-Served-By": "cache-lin1730061-LIN",
       "X-Timer": "S1719206093.656403,VS0,VE150",
       "X-XSS-Protection": "1; mode=block"
     },
     "Status": "200"
   },
   "Thread": "0x000001fa1d6b46c0",
   "Total time (ms)": 7,
   "URL": "https://raw.githubusercontent.com/google/fonts/main/ofl/opensans/OpenSans-Italic%5Bwdth%2Cwght%5D.ttf"
 },
 {
   "Bytes Received": 0,
   "Bytes Total": 0,
   "Cache (control)": "Load from cache if available, otherwise load from network",
   "Cache (save)": "Can store result in cache",
   "Headers": {
     "User-Agent": "Mozilla/5.0 QGIS/33900/Windows 10 Version 1903"
   },
   "ID": "src/core/textrenderer/qgsfontmanager.cpp:2129 (run)",
   "Initiator": "QgsFontDownloadTask",
   "Operation": "GET",
   "Replies": 1,
   "Reply": {
     "Cache (result)": "Read from network",
     "Headers": {
       "Access-Control-Allow-Origin": "",
       "Cache-Control": "no-cache",
       "Content-Length": "0",
       "Content-Security-Policy": "default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com api.githubcopilot.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com/v1/engines/github-completion/completions *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/",
       "Content-Type": "text/html; charset=utf-8",
       "Date": "Mon, 24 Jun 2024 05:18:28 GMT",
       "Location": "https://raw.githubusercontent.com/google/fonts/main/ofl/opensans/OFL.txt",
       "Referrer-Policy": "no-referrer-when-downgrade",
       "Server": "GitHub.com",
       "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
       "Vary": "X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With",
       "X-Content-Type-Options": "nosniff",
       "X-Frame-Options": "deny",
       "X-GitHub-Request-Id": "DC84:C1F32:79586D1:7C426FF:667901A4",
       "X-XSS-Protection": "0"
     },
     "Status": "302"
   },
   "Thread": "0x000001fa1d6b46c0",
   "Total time (ms)": 487,
   "URL": "https://github.com/google/fonts/raw/main/ofl/opensans/OFL.txt"
 },
 {
   "Bytes Received": 0,
   "Bytes Total": 0,
   "Cache (control)": "Load from cache if available, otherwise load from network",
   "Cache (save)": "Can store result in cache",
   "Headers": {
     "User-Agent": "Mozilla/5.0 QGIS/33900/Windows 10 Version 1903"
   },
   "Initiator": "unknown",
   "Operation": "GET",
   "Replies": 2,
   "Reply": {
     "Cache (result)": "Used entry from cache",
     "Headers": {
       "Accept-Ranges": "bytes",
       "Access-Control-Allow-Origin": "*",
       "Content-Encoding": "gzip",
       "Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; sandbox",
       "Content-Type": "text/plain; charset=utf-8",
       "Cross-Origin-Resource-Policy": "cross-origin",
       "Date": "Mon, 24 Jun 2024 05:14:53 GMT",
       "ETag": "W/\"9eb464e7bdc26b365f9cc1f4ad0f51128a9706a6cb834b452297943726bedec8\"",
       "Expires": "Mon, 24 Jun 2024 05:19:53 GMT",
       "Source-Age": "0",
       "Strict-Transport-Security": "max-age=31536000",
       "Vary": "Authorization,Accept-Encoding,Origin",
       "Via": "1.1 varnish",
       "X-Cache": "HIT",
       "X-Cache-Hits": "0",
       "X-Content-Type-Options": "nosniff",
       "X-Fastly-Request-ID": "986d225ac857cac3213ce2dbbab349718c6ef9bf",
       "X-Frame-Options": "deny",
       "X-GitHub-Request-Id": "4EF4:F6521:148612A:1590DD6:6678B2B4",
       "X-Served-By": "cache-lin1730061-LIN",
       "X-Timer": "S1719206094.518435,VS0,VE134",
       "X-XSS-Protection": "1; mode=block"
     },
     "Status": "200"
   },
   "Thread": "0x000001fa1d6b46c0",
   "Total time (ms)": 4,
   "URL": "https://raw.githubusercontent.com/google/fonts/main/ofl/opensans/OFL.txt"
 }

@nyalldawson
Copy link
Collaborator Author

Thanks @agiudiceandrea -- can you test with the updated version?

@agiudiceandrea
Copy link
Contributor

Using the new build the issue still occurs. The only difference compared to the previous build is that the message in the tab "General" of the Log Messages panel is now:
WARNING Error opening zip archive: 'C:/Users/Andrea/AppData/Local/Temp/wSgxgq.ttf' (Error code: 19)

@nyalldawson
Copy link
Collaborator Author

@agiudiceandrea ok. I suggest we merge this and then test on the nightlies. Maybe it's a mingw issue.

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jun 25, 2024

A random_name.ttf file of 532636 bytes (provided here in a zip archive GUqNdY.zip because .ttf files cannot be attached to a comment) is actually created in the %temp% folder and suddenly deleted.

@nyalldawson
Copy link
Collaborator Author

@agiudiceandrea

That's expected. We then try to open it as a font, and if that fails, we open as a zip. From my tests qt on windows required ttf as the extension for this to work, which is what this pr addresses.

@agiudiceandrea
Copy link
Contributor

When the .ttf file is added in the QFontDatabase at

int id = QFontDatabase::addApplicationFont( sourcePath );

the returned id is -1

Anyway, in the Python console, the same instruction correctly returns the value 2

sourcePath = "C:/Users/Andrea/AppData/Local/Temp/GUqNdY.ttf"
id = QFontDatabase.addApplicationFont( sourcepath )
print(id)
2

@nyalldawson
Copy link
Collaborator Author

@agiudiceandrea ok, let's see if this hack workaround works...

@agiudiceandrea
Copy link
Contributor

@nyalldawson, using the latest MinGW64 Windows Build the the warning message Open Sans font installation failed is no longer displayed and the info message Installed font Open Sans is displayed, instead!

The fonts folder, in the user profile folder, now contains the files Open Sans and Open Sans_2 (without extensions) and the two fonts are listed in Settings->Options->Fonts->User Fonts
image

Anyway, previously the fonts folder contained about 38 font files with the .ttf extension and more meaningful names

image

@nyalldawson
Copy link
Collaborator Author

@agiudiceandrea there's only two files available from Google Fonts -- see https://github.com/google/fonts/tree/main/ofl/opensans . I'm not sure where the others came from.

@agiudiceandrea
Copy link
Contributor

I'm not sure where the others came from.

@nyalldawson, they were previously downloaded by QGIS from https://fonts.google.com/download?family=Open+Sans
The downloaded zip file contains exactly 38 .ttf font files files.

@nyalldawson
Copy link
Collaborator Author

@agiudiceandrea that's what I mean -- the GitHub repo is supposed to be the source of those files, so I'm not sure where they come from.

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jun 26, 2024

the GitHub repo is supposed to be the source of those files, so I'm not sure where they come from.

It looks like the two files OpenSans-Italic[wdth,wght].ttf and OpenSans[wdth,wght].ttf available at https://github.com/google/fonts/tree/main/ofl/opensans corresponds to the OpenSans-Italic-VariableFont_wdth,wght.ttf and OpenSans-VariableFont_wdth,wght.ttf files contained in the root folder of the zip file downloadable from https://fonts.google.com/download?family=Open+Sans

Such OpenSans-Italic[wdth,wght].ttf and OpenSans[wdth,wght].ttf files are also available at https://github.com/googlefonts/opensans/tree/main/fonts/variable.
In the same repository at https://github.com/googlefonts/opensans/tree/main/fonts/ttf are also available 20 of the other 36 font files available in the "static" folder inside the zip file downloadable from https://fonts.google.com/download?family=Open+Sans

Perhaps the repo https://github.com/googlefonts/opensans/ may be used instead of https://github.com/google/fonts/tree/main/ofl/opensans.

@nyalldawson
Copy link
Collaborator Author

@agiudiceandrea ok, I propose that we merge this pr as it fixes the issue for the majority of fonts. Then extra logic could potentially be added later if we want to use different sources for individual fonts.

@agiudiceandrea
Copy link
Contributor

ok

@nyalldawson nyalldawson merged commit 6f79ad0 into qgis:master Jun 26, 2024
29 checks passed
@nyalldawson nyalldawson deleted the fix_font_download_wind branch June 26, 2024 20:17
@qgis-bot
Copy link
Collaborator

The backport to queued_ltr_backports failed:

The process '/usr/bin/git' failed with exit code 1
stderr
error: could not apply f4204877541... Fix automatic font download on Windows
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config advice.mergeConflict false"

stdout
Auto-merging python/PyQt6/core/auto_generated/textrenderer/qgsfontmanager.sip.in
Auto-merging python/core/auto_generated/textrenderer/qgsfontmanager.sip.in
Auto-merging src/core/textrenderer/qgsfontmanager.cpp
CONFLICT (content): Merge conflict in src/core/textrenderer/qgsfontmanager.cpp
Auto-merging src/core/textrenderer/qgsfontmanager.h

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-queued_ltr_backports queued_ltr_backports
# Navigate to the new working tree
cd .worktrees/backport-queued_ltr_backports
# Create a new branch
git switch --create backport-57844-to-queued_ltr_backports
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick f4204877541538b817e5182a9e4799b871dc2f26,2fd8813c44ef0f03deace4f7c6581d9f4ef0da80
# Push it to GitHub
git push --set-upstream origin backport-57844-to-queued_ltr_backports
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-queued_ltr_backports

Then, create a pull request where the base branch is queued_ltr_backports and the compare/head branch is backport-57844-to-queued_ltr_backports.

@qgis-bot qgis-bot added the failed backport The automated backport attempt failed, needs a manual backport label Jun 26, 2024
@agiudiceandrea
Copy link
Contributor

For a future enhancement: all the 38 font files of the "Open Sans" family previously directly downloaded by QGIS in a zip file from https://fonts.google.com/download?family=Open+Sans can be directly downloaded using the json file directly downloadable from https://fonts.google.com/download/list?family=Open+Sans which lists each font file and the corresponding URL from which it can be downloaded.

Can't we directly host the zip file containing all the 38 "Open Sans" font files of the "Open Sans" family and make QGIS download it from there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport queued_ltr_backports Queued Backports failed backport The automated backport attempt failed, needs a manual backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants