View Single Post
Old 07-28-2025, 02:42 PM   #23
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,852
Karma: 8821117
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
So I changed the _loader.js to enable "FORCEHYPENOPOLY", in its internal config and I can see from the Inspector and the javascipt error console that the wasm file is being found and loaded and that Hyphenopoly.js is being loaded as a blob.
Great!! Then Hyphenopoly must work in Sigil.

Quote:
All as expected, but how can I tell if it is actually working or not given hypehnation is built in (at least on macOS).
Ok. Try the following:

1. In the sample epub I sent you, change the style .hyphenate to:

Code:
.hyphenate {
  hyphens: manual;
  -moz-hyphens: manual;
  -webkit-hyphens: manual;
  -ms-hyphens: manual;
}
So, even if the hyphenation is set to manual in the style sheet, it will still be applied to the <body> selector and its descendants (i.e., the entire .xhtml file) but this time by Hyphenopoly, not for the MAC native support. MAC only will apply hyphens when it finds a "shy" char in the text and there is none.

2. Employ "FORCEHYPHENOPOLY" to force the loader to load Hyphenopoly.js and the .wasm file.

3. THIS IS VERY IMPORTANT: in your config section you must add the following:

Code:
    setup: {
        selectors: {
            "body": {
                compound: "all",
                leftmin: 1, // This is not neccessary but will hyphenate more words
                rightmin: 2 // This is not neccessary
            }
        }
    }
So, your whole config section should look like the following (you'll do better if copy and paste):

Code:
Hyphenopoly.config({
    require: {
        "es": "FORCEHYPHENOPOLY",
    },
    paths: {
        patterndir: "../../META-INF/"
    },
    setup: {
        selectors: {
            "body": {
                compound: "all",
                leftmin: 1,
                rightmin: 2
            }
        }
    }
});
With the .hyphenate style in the .css sheet set in "manual", the native hyphenation will be disable and in Readium (or JSReader) hyphenation will only be controlled by Hyphenopoly.

Last edited by RbnJrg; 07-28-2025 at 02:48 PM.
RbnJrg is offline   Reply With Quote