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


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

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 10 Sep 22, 20:42   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Thanks! I would still prefer to make it work on older versions too. Even though the function drops this error, the fonts still get copied, at least on my PC - in all versions. I will have to wait for David to look into this.
No wonder Tiger behaves the same way - my skins share the same code base.
Laza

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 12 Sep 22, 13:48   in response to: martinherbst in response to: martinherbst
 
  Click to reply to this thread Reply
Attachment Story.jaskin (2.0 MB)
Could you please test what this version prints out to the console when copying fails?
(Set Preferences / Logging level to FINER at least!)
JeffTucker

Posts: 8,097
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 12 Sep 22, 14:08   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Here's what I get on the Mac, running jAlbum 28.1.5:
Sep 12, 2022 8:06:21 AM se.datadosen.jalbum.AlbumBean prepareMakeAlbum
FINE: clean: 0.012s
Sep 12, 2022 8:06:21 AM se.datadosen.jalbum.AlbumBean fireStatus
FINER: Initializing...
Sep 12, 2022 8:06:21 AM se.datadosen.jalbum.ScriptEnginePool doGet
FINER: Initializing bsh.BshScriptEngine@74225525
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
Cache hit for /Users/JT/Library/JAlbum/skins/Story/lib/util.js
Cache hit for /Users/JT/Library/JAlbum/skins/Story/init.js
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
XBorderFilter V0.97 - 2005 J.Troeger. Modified by jAlbum
 
Making "aa" (Changes)
WARNING: Couldn't fetch the fonts from Google. You are probably offline, or the connection to Google is blocked!
java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.runtime.Undefined to javax.net.ssl.SSLSocketFactory
	at java.base/java.lang.Class.cast(Unknown Source)
	at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$38$126463A$util.syncGoogleFonts(/Users/JT/Library/JAlbum/skins/Story/lib/util.js:5063)
	at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$24$\^eval\_.:program(<eval>:77)
	at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(Unknown Source)
	at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.invoke(Unknown Source)
	at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptRuntime.apply(Unknown Source)
	at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(Unknown Source)
	at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine$3.eval(Unknown Source)
	at java.scripting/javax.script.CompiledScript.eval(Unknown Source)
	at se.datadosen.jalbum.ast.ScriptletNode.doEval(ScriptletNode.java:60)
	at se.datadosen.jalbum.ast.ASTNode.eval(ASTNode.java:50)
	at se.datadosen.jalbum.ast.GroupNode.doEval(GroupNode.java:78)
	at se.datadosen.jalbum.ast.ASTNode.eval(ASTNode.java:50)
	at se.datadosen.jalbum.AST.eval(AST.java:68)
	at se.datadosen.jalbum.AlbumBean.processTemplateFile(AlbumBean.java:1573)
	at se.datadosen.jalbum.AlbumBean.makeAlbumForFolder(AlbumBean.java:1808)
	at se.datadosen.jalbum.AlbumBean.makeAlbum(AlbumBean.java:3262)
	at se.datadosen.jalbum.AlbumBean.smartMakeAlbum(AlbumBean.java:3154)
	at se.datadosen.jalbum.JAlbumFrame$7.run(JAlbumFrame.java:1170)
Cache hit for /Users/JT/Library/JAlbum/skins/Story/predir.js
Sep 12, 2022 8:06:22 AM se.datadosen.jalbum.JSONMaker <init>
FINER: Using paging: 0
Making deep-data.json: 0.007s
"aa" made in 1.296s
Cache hit for /Users/JT/Library/JAlbum/skins/Story/finally.js
Laza

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 12 Sep 22, 15:31   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Thanks, this is what no one knows why happens. Still, on my PC the fonts are copied to the /res/fonts folder. So I guess it's not a serious bug.
JeffTucker

Posts: 8,097
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 12 Sep 22, 15:40   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Laza wrote:
So I guess it's not a serious bug.

You mean, except for the fact that a user who chooses Copy Google fonts ends up with an album that doesn't use the chosen Google fonts at all? I think I'd call that a serious bug.

Remember, I'm seeing this on two different platforms, with very "clean" environments - default installation of jAlbum, running with the bundled Java, default skin settings (other than the font copy option), test project created in Documents/My Albums, no third-party security software. In short, nothing out of the ordinary. And it would appear that other users are experiencing the same thing.
Laza

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 12 Sep 22, 19:56   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
No, I mean if the warning shows up, but the fonts are copied, as it happens with jAlbum 24.1 here. If the fonts are missing that's a problem, of course.
JeffTucker

Posts: 8,097
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 12 Sep 22, 21:10   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
For me, the fonts are never copied in jAlbum 28.1.5. Never. Ever. The fonts are always missing in the album.

ETA: And to be clear, when this happens, the album doesn't fall back to using the normal mechanism for displaying Google fonts. The album title is just shown using the font family chosen for the rest of the album.

ETA: BTW, I don't think that there should be a fallback if the Google font can't be copied. People who choose the "copy" option are doing so to avoid GDPR problems. They wouldn't want to think it was working, only to discover that their pages are, once again, "phoning home" to Google!
Laza

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 13 Sep 22, 20:44   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I must admit I have no idea how the fallback happens. As copying the fonts never failed here, I can't even test. Tomorrow I'll make a test that simulates the error, and probably shows me how this fallback works. It's not intentional.
JeffTucker

Posts: 8,097
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 13 Sep 22, 21:15   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
There is no fallback, and that's a good thing, for the reasons I've stated.

It simply fails to copy the Google font to the project, and the page is now trying to use a font that it doesn't have.
Laza

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 13 Sep 22, 21:19   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Huhh, it seems the space in the font's name triggered the error. I could not reproduce it until I chose "La Belle Aurore". I tested now with unplugged internet, and the headline font falls back to the BODY font. If the BODY font was also a Google font, all fonts fall back to "serif" or "sans-serif". You can check with the developer tools, there's no attempt to reach the google server.
Hopefully, the attached version works for you too.

ETA: I guess it'll still fail on the old Nashorn :( - the space was just part of the problem.

Edited by: Laza on 13 Sep 2022, 21:36

Edited by: Laza on 14 Sep 2022, 19:44
Removed skin file
JeffTucker

Posts: 8,097
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 13 Sep 22, 21:48   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Indeed, it's still failing in 28.1.5.

I've been thinking about this, and I think the smart move may be to have the skin always copy the Google font. I don't mean having that option set to the default - I mean having no other option.

The files are very small, loading locally from a WOFF file is almost certainly going to be faster, and there's no need to do any preloading - the page isn't calling some remote server to get the font. It gets loaded as soon as the page starts reading the CSS file, as long as you always put the @font-face attributes at the beginning of the file. And there's never any GDPR problem with it.

Under what circumstances would it be advantageous to have the page get the font at viewing time from Google, instead?
Laza

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 14 Sep 22, 13:44   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Yes, you got a point. Even though gathering the external files from different sites sometimes might be faster - I believe the security / privacy concerns now outweigh this.

On 28.1.8 for me, it works flawlessly, not even the beta is needed.
Laza

Posts: 1,629
Registered: 6-Sep-2005
Re: Copy Google Fonts does not work
Posted: 14 Sep 22, 17:42   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I could make it work now. It seems it's Nashorn's IO.readTextUrl method that fails on older jAlbums. The new Nashorn works fine. So when my routine catches an exception it tries another method to read the Google CSS file, but unfortunately, this other one cannot spoof the browser as Chrome, so Google provides Truetype fonts instead of the modern Woff2 format. Anyway, for most users copying the fonts will work, albeit for extended codepages (like Cyrillic, greek and such) some characters will be missing due to the dumb TTF format.

(I have updated the skin v2.21, and removed the beta from here.)
JeffTucker

Posts: 8,097
Registered: 31-Jan-2006
Re: Copy Google Fonts does not work
Posted: 14 Sep 22, 20:56   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Yes, it's now happy on jAlbum 28.1.5, at least on the Mac.

(Keeping older versions of jAlbum on Windows seems OK, right up until you try to remove one of them. Then bad things happen. Primarily, Windows loses the file associations, and .jaskin files don't install properly, etc. You end up having to remove all of them, then reinstall the one you want to run with.)
ronvanrossum

Posts: 65
Registered: 16-Jul-2014
Re: Copy Google Fonts does not work
Posted: 15 Sep 22, 08:58   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Story v.2.21.0, minor error, Google fonts are preloaded double.
<link rel="preload" href="res/icon/lazaicon18.woff?asdk7qe" as="font" type="font/woff" crossorigin>
<link rel="preload" href="res/fonts/HhyJU5sn9vOmLxNkIwRSjTVNWLEJ6bQl2xME.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="res/fonts/2-c79IRs1JiJN1FRAMjTN5zd9vgsFHXwcjfj9w.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="res/fonts/2-c79IRs1JiJN1FRAMjTN5zd9vgsFHXwcjfj9w.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="res/fonts/2-c99IRs1JiJN1FRAMjTN5zd9vgsFHX1QjU.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="res/fonts/2-c99IRs1JiJN1FRAMjTN5zd9vgsFHX1QjU.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="res/common.css?v=2.21">
Legend
Forum admins
Helpful Answer
Correct Answer

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