Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 07-20-2025, 12:00 PM   #1
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
An issue with the .opf

I'm thinking to replace in my epub3 the JS program "Hyphenator" by the also JS program "Hyphenopoly". But I'm running into a problem: Hyphenopoly uses .wasm files as language patterns, which I include in Sigil's Misc folder. Hyphenopoly works fine, but when I open the epubs that contain it with Sigil, I get the following warning message:

Warning: the OPF contains missing or unrecognized media types...

Of course, in the .opf, the .wasm files have the media type 'application/wasm' that causes the warning. Is there a way to suppress that message? By the way, epubcheck also gives the same warning; by chance, are .wasm files prohibited files?
RbnJrg is offline   Reply With Quote
Old 07-20-2025, 12:07 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
They are not recognized media file types according to the epub 3.3 spec. You may be able to "hide" them in the METAINF folder but not sure. WebAssembly files do not run with every browser.

Since they are binary data files that are only opened by javascript, perhaps including their data directly into the js file might be best for that. According to a web search you can do that by encoding the Wasm binary as a base64 string and then decoding it within the JavaScript code.

The epub 3.4 spec is currently working on this, and may add support for webassembly .wasm files.

Hard to follow but I found this:

https://w3c.github.io/pm-wg/minutes/...2-27.html#d6c2


The epub 3.4 spec is the one that is proposing allowing pure html as well. It will be a few months before it gets approved one way or the other.

Here is a quote from the draft epub 3.4 spec:

Quote:
In addition to the content-specific exemptions, a resource is classified as an exempt resource if:

it is not referenced from a spine itemref element (i.e., used as a foreign content document); and

it is not directly rendered in its native format in an EPUB content document.

This exemption allows EPUB creators to include resources in the EPUB container that are not for use by EPUB reading systems. Resources that benefit from this exemption include:

script code modules, such as WebAssembly [wasm-core-2];
script inputs, such as fetched [fetch] data or images (refer to 6.3.2.5 Scripting fallbacks for restrictions on dynamically adding such resources to EPUB content documents);
data files for use by external applications (e.g., a scientific journal might include a data set with instructions on how to extract it from the EPUB container).
The spec did not say what this exemption means for inclusion in the OPF manifest, but my guess is it would be required. It just means that those files will not require fallback resources once the epub 3.4 spec gets approved sometime in the future.

Once whatever form of epub 3.4 spec gets finally approved, then a future version of Sigil will add them to its recognized media types list. But it may take awhile until epubcheck allows them. That also means most publishers will not currently allow them.

Last edited by KevinH; 07-20-2025 at 12:46 PM.
KevinH is offline   Reply With Quote
Old 07-27-2025, 01:03 PM   #3
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
They are not recognized media file types according to the epub 3.3 spec. You may be able to "hide" them in the METAINF folder but not sure. WebAssembly files do not run with every browser.
For those who want to try using Hyphenopoly in their epubs to add hyphenation, I report that your idea of hiding the .wasm files in the META-INF folder is effective. There are no errors or warnings reported by Sigil, and epubCheck also finds no errors, while e-readers can find and use those files.
So, until "media type 'application/wasm'" is approved, placing the .wasm files in META-INF works.

By the way, except for IE, practically all browser supports .wasm:

https://caniuse.com/wasm

Last edited by RbnJrg; 07-27-2025 at 01:08 PM.
RbnJrg is offline   Reply With Quote
Old 07-27-2025, 01:15 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
Understand that Qt's QtWebEngine is just lately based on Chrome 138 and that is the first support for Android as well. So this support is quite recent and may not work with Qt 5 or Qt 6 up to 6.6 or 6.7.

I am glad to hear that hiding them in METAINF works for you.

Do you still include them in the manifest itself with the href pointing into METAINF under a different media-type or just not mention they are there at all in the OPF?

Last edited by KevinH; 07-27-2025 at 02:57 PM.
KevinH is offline   Reply With Quote
Old 07-27-2025, 05:15 PM   #5
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Do you still include them in the manifest itself with the href pointing into METAINF under a different media-type or just not mention they are there at all in the OPF?
No, I just don't mention the .wasm file anywhere; I only incluye the proper path to pattern files (.wasm) in Hyphenoly_loader.js. By doing so, as I said, Sigil doesn't report warning or errors and epubcheck accepts the epubs as correct.

By the way, under Sigil Hyphenopoly doesn't work (it has issues with the fetch api) but it works fine with ereaders.
RbnJrg is offline   Reply With Quote
Old 07-27-2025, 06:52 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
I think there is a QtWebEngineURl Scheme setting that enables the fetch api. If the fetch is foreign though you would have to enable the remote access in Sigil Preferences too.

Is that js opening any Windows, as I think that is disabled as well?

What scheme does the url passed to fetch() use? Is it a private scheme or http or https?

Can you please post a very simple epub test case with it and I will see if I can get things to work on Sigil too by changing the QWebEngineProfile, QWebEngineSettings, and/or our Sigil url scheme handler settings settings that Sigil uses.

Last edited by KevinH; 07-27-2025 at 07:31 PM.
KevinH is offline   Reply With Quote
Old 07-27-2025, 11:01 PM   #7
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
I think there is a QtWebEngineURl Scheme setting that enables the fetch api. If the fetch is foreign though you would have to enable the remote access in Sigil Preferences too.

Is that js opening any Windows, as I think that is disabled as well?

What scheme does the url passed to fetch() use? Is it a private scheme or http or https?

Can you please post a very simple epub test case with it and I will see if I can get things to work on Sigil too by changing the QWebEngineProfile, QWebEngineSettings, and/or our Sigil url scheme handler settings settings that Sigil uses.
Hi Kevin;

I attach an epub with the javascript files of Hyphenopoly and a .wasm (in this case, is the pattern for spanish but for a test it can be used without issues). If you open the attached epub with the Sigil's plugins Readium and Epub JSReader you'll see that the epub is hyphened.

With the inspector you can watch that Sigil can't find/load the pattern (.wasm) file in line 179 of Hyphenopoly_Loader.js and also can't find/load Hyphenopoly.js in line 232. The loader first test if there is native support for hyphenation; if is supported, it does nothing; otherwise, it loads the language pattern and the hyphenation engine (Hyphenopoly.js).
Attached Files
File Type: epub Hyphenopoly (Ter).epub (25.8 KB, 16 views)
RbnJrg is offline   Reply With Quote
Old 07-28-2025, 09:45 AM   #8
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
Hmm, this is going to be a bit harder to debug than I thought. It seems on my MacOS machine with the latest build of Sigil master, the hyphenation works so Hyphenopoly is never loaded. The Inspector shows that no wasm files were loaded because none were needed (no error message shown in Network activitiy nor the js console.

Is there an easy way to force it to load the wasm file and force run Hyphenopoly?
Attached Thumbnails
Click image for larger version

Name:	hyphenation_works.png
Views:	7
Size:	146.4 KB
ID:	217154  

Last edited by KevinH; 07-28-2025 at 09:47 AM.
KevinH is offline   Reply With Quote
Old 07-28-2025, 10:21 AM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
Okay I figured out how to force load Hyphenopoly using the following and disabling hyphenation in the css:

Code:
<script type="text/javascript">
    Hyphenopoly.config({
        require: {
            "es": "FORCEHYPHENOPOLY"
        }
    });
</script>
Then I changed the sigil scheme to allow it to use the fetch api and rebuilt Sigil.

That gets me to here: (Debug info from Sigil's URLInterceptor.cpp and URLSchemeHandler.cpp)

Code:
Debug: URLInterceptor
Debug:     method:  "GET"
Debug:     1st party url:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Text/Section0001.xhtml")
Debug:     request url:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
Debug:     navtype:  0
Debug:     restype:  13
Debug:     ActiveWindow:  MainWindow(0x7f8828226c00, name="MainWindow")
     
Debug: In URLSchemeHandler with url:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
Debug: In URLSchemeHandler with method:  "GET"
Debug: In URLSchemeHandler with initiator:  QUrl("sigil:")

Debug: URLSchemeHandler will fail request because no local file found:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")

Debug: URLSchemeHandler failed request for:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
which shows it fails because it is not trying to load the .wasm files from the correct location inside the META-INF folder:

QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")

instead it is looking right beside the other js files.

Where in your javascript loader do you tell it where to find the .wasm files?


Someplace there should be a "../../../META-INF/" appended before the file name to actually load the wasm files:

Last edited by KevinH; 07-28-2025 at 11:14 AM.
KevinH is offline   Reply With Quote
Old 07-28-2025, 11:12 AM   #10
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
So in line 179, I was able to prepend the required "../../../META-INF/" and now it finds the wasm file.

But unfortunately after that while trying to load the Hyphenopoly hyphenator itself it fails in many places. The file is found and loaded but the javascript QtWebEngine console shows this as the first error:

Code:
Debug: Javascript error:  QWebEnginePage::ErrorMessageLevel "Uncaught TypeError: Cannot read properties of null (reading 'hev') on line:35 Source:blob:sigil:/0828457a-16e9-47b5-8750-affcad42ce86"
That blob is the Hyphenopoly.js file itself and line 35 is here:

Code:
       if (H.hev) {
            const userEvents = new Map(o.entries(H.hev));
            knownEvents.forEach((eventFuncs, eventName) => {
                if (userEvents.has(eventName)) {
                    eventFuncs.unshift(userEvents.get(eventName));
                }
            });
        }
Forcing it to skip that just results in addition errors. So no H object is found and no attribute .hev exists.


Are you sure this all actually worked in the Readium plugin? Maybe it is just the QWebEngine hyphenator working inside the Sigil readium plugin?
KevinH is offline   Reply With Quote
Old 07-28-2025, 11:20 AM   #11
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Hi Kevin;

Thank you very much for your efforts. You must define the path to .wasm files in the config script. I have that config in Hyphenopoly_Loader.js so I don't have to write it in each .xhtml file; that way just by including the next declaration in the header is enough:

Code:
<script type="text/javascript" src="../Misc/Hyphenopoly_Loader.js" ></script>
But as you are using the following declaration:

Code:
<script type="text/javascript">
    Hyphenopoly.config({
        require: {
            "es": "FORCEHYPHENOPOLY",
            "de": "Silbentrennungsalgorithmus"
        }
    });

    console.log(Hyphenopoly.hyphenators); //{en-us: Promise, HTML: Promise}
</script>
you need to include there the following:

Code:
    paths: {
        patterndir: "../../META-INF/"
    },
Of that way you should have as final code the following:

Code:
<script type="text/javascript">
    Hyphenopoly.config({
        require: {
            "es": "FORCEHYPHENOPOLY",
            "de": "Silbentrennungsalgorithmus"
        }, // DON'T OMIT THE COMMA HERE
        paths: {
            patterndir: "../../META-INF/"
        } // AND HERE NO COMMA
    });

    console.log(Hyphenopoly.hyphenators); //{en-us: Promise, HTML: Promise}
</script>
Take into account that you must include in META-INF the files es.wasm and de.wasm. You can include the .wasm ones in "Misc" but Sigil will warn you and epubcheck will give an error. And yes, with "FORCEHYPHENOPOLY", you force the loader to load Hyphenopoly.js. One more thing; if you are going to employ others .wasm, write in the paragraphs, divs or whatever element to want hyphenation lang="xx", where "xx" is the language you are going to use.


Quote:
Originally Posted by KevinH View Post
Okay I figured out how to force load Hyphenopoly using the following and disabling hyphenation in the css:

Code:
<script type="text/javascript">
    Hyphenopoly.config({
        require: {
            "es": "FORCEHYPHENOPOLY",
            "de": "Silbentrennungsalgorithmus"
        }
    });

    console.log(Hyphenopoly.hyphenators); //{en-us: Promise, HTML: Promise}
</script>
Then changed the sigil scheme to allow it to use the fetch api and rebuilt Sigil.

That gets me to here: (Debug info from Sigil's URLInterceptor.cpp and URLSchemeHandler.cpp)

Code:
Debug: URLInterceptor
Debug:     method:  "GET"
Debug:     1st party url:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Text/Section0001.xhtml")
Debug:     request url:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
Debug:     navtype:  0
Debug:     restype:  13
Debug:     ActiveWindow:  MainWindow(0x7f8828226c00, name="MainWindow")
     
Debug: In URLSchemeHandler with url:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
Debug: In URLSchemeHandler with method:  "GET"
Debug: In URLSchemeHandler with initiator:  QUrl("sigil:")

Debug: URLSchemeHandler will fail request because no local file found:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")

Debug: URLSchemeHandler failed request for:  QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
which shows it fails because it is not trying to load the .wasm files from the correct location inside the META-INF folder:

QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")

instead it is looking right beside the other js files.

Where in you javascript loader do you tell it where to find the .wasm files?


Someplace there should be a "../../../META-INF/" appended before the file name to actually load the wasm files:
RbnJrg is offline   Reply With Quote
Old 07-28-2025, 11:26 AM   #12
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
Are you sure this all actually worked in the Readium plugin? Maybe it is just the QWebEngine hyphenator working inside the Sigil readium plugin?
No, it works everywhere In Readium, in EPUB JSReader, in Thorium, in Android apps (Cantook, Reasily, Lithium, Kobo for Android, Infinity Reader, and any ereader that supports JS. Open the epub I attached with Readium in Sigil and you'll the hyphenation.

The only places where Hyphenopoly is not working is in Sigil, Calibre and Bibi Reader (Bibi incluso tiene problemas con Hyphenator, which is the JS I have been using so far.

EDIT: Here you have some screenshots of Readium, JSReader and Thorium:

Click image for larger version

Name:	One1.jpg
Views:	11
Size:	83.1 KB
ID:	217162 Click image for larger version

Name:	One2.jpg
Views:	10
Size:	74.5 KB
ID:	217163 Click image for larger version

Name:	One3.jpg
Views:	9
Size:	204.4 KB
ID:	217164

Last edited by RbnJrg; 07-28-2025 at 11:39 AM.
RbnJrg is offline   Reply With Quote
Old 07-28-2025, 11:27 AM   #13
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
I even tried skipping the loader completely and directly loading Hyphenopoly.js and got the following error in the Javascript Console:

Debug: Javascript error: QWebEnginePage::ErrorMessageLevel "Uncaught ReferenceError: Hyphenopoly is not defined on line:61

Source:sigil:///Users/kbhend/Library/Application%20Support/sigil-ebook/sigil/workspace/Sigil-BxImZW/OEBPS/Misc/Hyphenopoly.js"

So the Hyphenopoly object itself is undefined. It is almost if the javascript version was for a different release than what is needed.

Very very strange.

Then as a final test I commented out the loader script itself and the Readium plugin happily hyphenated everthing even with no Hyphenopoly installed.

So I do not think Hyphenopoloy is used/working at all in that sample epub even if Sigil is modified to allow the fetch api in the "sigil" url schemehandler. I will push that one line change to master anyway, in the hopes you can get things to work eventually.

There is no way it is finding the .wasm files with the path generated by the Hyphenopoly_loader.js as it is looking in the wrong place for those files.

The latest QtWebEngine and Electron builds have a built in hyphenator.

Last edited by KevinH; 07-28-2025 at 11:53 AM.
KevinH is offline   Reply With Quote
Old 07-28-2025, 11:59 AM   #14
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
When you run the loader.js, in line 179 you have the message:

Code:
FETCH API cannot load Sigil:///... URL scheme Sigil is not supported
That is because Hyphenopoly waits an url that starts with "file:" and not "Sigil:".

Do the following:

1. Open the epub I sent with Sigil.
2. Do right click in Section0001.xhtml and select Open with Chrome (or Firefox) and once the file is loaded in the browser, enable the Development tools and you'll be able to run the script there. Put a breakpoint in line 168 and press F5 to rerun the loader.js.
3. In line 179, you'll see that H.paths gives you as "maindir" something like "file:///.../Misc" and as "patterndir" "../../META-INF".
4. The issue is that Sigil as maindir gives us something like "Sigil:///.../Misc" and that can't be handle by Hyphenopoly.




Quote:
Originally Posted by KevinH View Post
I even tried skipping the loader completely and directly loading Hyphenopoly.js and got the following error in the Javascript Console:

Debug: Javascript error: QWebEnginePage::ErrorMessageLevel "Uncaught ReferenceError: Hyphenopoly is not defined on line:61

Source:sigil:///Users/kbhend/Library/Application%20Support/sigil-ebook/sigil/workspace/Sigil-BxImZW/OEBPS/Misc/Hyphenopoly.js"

So the Hyphenopoly object itself is undefined. It is almost if the javascript version was for a different release than what is needed.

Very very strange.
RbnJrg is offline   Reply With Quote
Old 07-28-2025, 12:07 PM   #15
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
So I do not think Hyphenopoloy is used/working at all in that sample epub even if Sigil is modified to allow the fetch api in the "sigil" url schemehandler.
It's easy to test that. Open the epub I sent in Thorium; you'll see that hyphenation works. After that remove the script from the epub sample and open it again in Thorium; you won't see any hyphenation. Maybe things are different on Mac; on Windows and Linux the script works fine.
RbnJrg is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
IngramSpark citing content.opf errors I can't find in the .opf persand Calibre 4 03-21-2019 10:49 AM
epub3 kobo external video opf issue Ryn ePub 21 01-13-2018 05:34 PM
Change opf filename from content.opf to title.opf northstar7 Sigil 3 09-23-2013 12:44 PM
Nook Covers OPF Issue DTM Sigil 2 08-03-2013 05:39 PM
TWO OPF files or something like Media Queries in the OPF file for KF8 and MOBI? DHahn Kindle Formats 3 04-17-2012 04:06 AM


All times are GMT -4. The time now is 04:30 AM.


MobileRead.com is a privately owned, operated and funded community.