This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 30 - Pages: 3 [ 1 2 3 | Next ] - Last Post: 15 Sep 22, 09:47 Last Post By: Laza Threads: [ Previous | Next ]
martinherbst

Posts: 7
Registered: 25-May-2017
Copy Google Fonts does not work
Posted: 8 Sep 22, 20:52
 
  Click to reply to this thread Reply
I have selected "Copy Google Fonts" but now no references to the fonts are created into the generated HTML code.

I have tried to find the reason. In page-header.inc this if statements fails:

if ((copyGoogleFonts === UNDEF || copyGoogleFonts) && typeof googleFontFaces !== UNDEF && !!googleFontFaces) {

copyGoogleFonts is set to true but googleFontFaces is empty (typeof returns String).

jAlbum version is 28.1.5
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 8 Sep 22, 21:43   in response to: martinherbst in response to: martinherbst
 
  Click to reply to this thread Reply
I just tried a simple test album with the Copy Google fonts option, and it works just fine. When the skin copies the font to the album, it's no longer a call to the Google site (which is precisely the point). It's added to the album as a WOFF file. Here's the line from the index.html of my test album:
<link rel="preload" href="res/fonts/daaCSScvJGqLYhG8nNt8KPPswUAPni7TTMw.woff2" as="font" type="font/woff2" crossorigin>
And the CSS is similarly modified:
/* Google Fonts */
/* latin */
@font-face {
  font-family: 'Cinzel Decorative';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/daaCSScvJGqLYhG8nNt8KPPswUAPni7TTMw.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 8 Sep 22, 21:45   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
BTW, for testing, choose one of the more obvious Google fonts for the headline, like Cinzel Decorative. That way, you can tell instantly whether it's working or not!
Laza

Posts: 1,627
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 08:20   in response to: martinherbst in response to: martinherbst
 
  Click to reply to this thread Reply
The copyGoogleFonts returns the font list copied to the local album. If you are offline or Google Fonts is inaccessible the string will be empty.
martinherbst

Posts: 7
Registered: 25-May-2017
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 18:53   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Thanks for your quick replies.

I have updated the skin to the latest version, but nothing changed. No fonts are downloaded to the res folder, and there is no @font-face entry added to common.css.

For the browser Google Fonts is accessible. If I don't select "Copy Google Fonts" the fonts are displayed correctly.

I have tried it with a fresh album but with same result.

I am running jAlbum on Windows 11 with Java 14 that is embedded into jAlbum.
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 19:34   in response to: martinherbst in response to: martinherbst
 
  Click to reply to this thread Reply
Do you have any third-party "security" software on your PC? It may be blocking access.
martinherbst

Posts: 7
Registered: 25-May-2017
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 19:54   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Nothing special. Only Microsoft Defender. I don't have any problems with accessing Google Fonts directly from Google. If I don't set "Copy Fonts" and open the generated HTML locally in the browser, the fonts are downloaded.

I can try to use Wireshark to see what's happening.
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 20:02   in response to: martinherbst in response to: martinherbst
 
  Click to reply to this thread Reply
Also please look at the jAlbum console - F7 - to see if there are any error messages.
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 20:05   in response to: martinherbst in response to: martinherbst
Helpful
  Click to reply to this thread Reply
Mystery solved. I tried the skin on jAlbum 28.1.5, and the routine for copying Google fonts fails. It works properly in jAlbum 28.2b3, which is still just a beta.

I'll leave it to Laza to figure out what to do about this. Perhaps the regular release of jAlbum 28.2 will occur soon.
martinherbst

Posts: 7
Registered: 25-May-2017
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 20:18   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Good to know the reason :-).

For me it is not a problem to wait for the next jAlbum release. I have already modified the skin to use local copy of the fonts. But I would be happy to get rid of my modifications.
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 20:24   in response to: martinherbst in response to: martinherbst
 
  Click to reply to this thread Reply
You could install the beta - it's very stable (it's the only version I have on my PC - I have the last regular release only on my Macbook).

https://jalbum.net/forum/thread.jspa?threadID=58458
martinherbst

Posts: 7
Registered: 25-May-2017
Re: Copy Google Fonts does not work
Posted: 9 Sep 22, 20:31   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Good idea. Will try it tomorrow :-).

Thanks for the link. Did not know that I could get it from the forum.

Edited by: martinherbst on 9 Sep 2022, 20:40
Laza

Posts: 1,627
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 10 Sep 22, 08:35   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Attachment util.js (145.1 KB)
Attachment Story.jar (188.3 KB)
That's really odd. For me, all versions work: 24.1, 28.1, and the beta. Although in 24.1 it writes out
WARNING: Couldn't fetch the fonts from Google. You are probably offline.

to the console, but it copies the fonts. The other versions work without a warning. I have recompiled it to Java 14, and the result is the same. (Attached is the new jar file)
When I printed out the cause of the error, jAlbum said:
java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.runtime.Undefined to javax.net.ssl.SSLSocketFactory

I guess it's about permission issues, and this could explain why you see different results on Mac. It's odd, but using http: instead of https: accessing the css file doesn't change the behavior.
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 10 Sep 22, 12:33   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
With the replaced files, in jAlbum 27.0.7 on Windows, the routine still fails, with these errors:
WARNING: Couldn't fetch the fonts from Google. You are probably offline. Please connect to the internet or turn off "Copy Google fonts"!
java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.runtime.Undefined to javax.net.ssl.SSLSocketFactory
I get exactly the same errors in jAlbum 28.1.5 on macOS.

Without the replaced files, I get the "Couldn't fetch..." message on both platforms, but not the "Cannot cast..." message.
JeffTucker

Posts: 8,095
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 10 Sep 22, 12:40   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
The latest release of Tiger produces the same failure and error message in older versions of jAlbum.

Instead of continuing to wrestle with this, perhaps the skin updates should be put on "hold" until jAlbum 28.2 is released. Forget about backward compatibility - It's not unreasonable for bundled skins to require the latest version of the core application.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums