mnater / Hyphenopoly

Hyphenation for node and Polyfill for client-side hyphenation.
http://mnater.github.io/Hyphenopoly/
MIT License
689 stars 45 forks source link

Future of this project #163

Open mnater opened 3 years ago

mnater commented 3 years ago

It looks like Chrome for Windows/Linux will support CSS-hyphens:auto starting with version M88. Edge will follow. That means the use case of Hyphenopoly as a polyfill for hyphenation will fade away pretty soon.

Of course, the question now is how to proceed with Hyphenopoly.

First ideas:

mnater commented 3 years ago

Update (2021-01-24)

Chrome m88 now supports hyphenation for a wide range of languages

MS Edge v88 doesn't.

mnater commented 3 years ago

Although claimed otherwise by caniuse (is updated), Edge 90 still does not support hyphens:auto.

mnater commented 3 years ago

Still no sign of hyphens:auto support in Edge 91 on Windows...

mnater commented 2 years ago

Still not in Edge 95...🤷‍♂️

mnater commented 2 years ago

and not in Edge 96 It's finally available in Edge 96 (just testet on Browser, caniuse seems aoutdated)

borriglione commented 2 years ago

@mnater

We still face the problem that hyphenation does not work on Chromium/Puppeteer in headless mode [1]. That's why we are using this package now and are very thankful that it's existing :)

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=1261480

mnater commented 2 years ago

Good to know. And thanks for the cheer!

sagarkt commented 2 years ago

@borriglione glad to know that you are able to use it with Puppeteer. I am too trying to generate pdfs with Puppeteer in headless mode. I am running it on AWS Lambda. I am unable to configure it properly. Can you give a shot config how you achieved it? That will be a lot of helpful. Thanks in advance!

borriglione commented 2 years ago

@sagarkt

It's very off-topic but:

    const browser = await puppeteer.launch({
      args: ['--font-render-hinting=none', '--disable-gpu'],
      headless: true,
    })
    const page = await browser.newPage()
    const res = await page.goto(ctx.query.url, { waitUntil: 'networkidle0' })
    ctx.status = res.status()
    await page.evaluateHandle('document.fonts.ready')
    await page.focus('body')
    ctx.body = await page.pdf({
        printBackground: true,
        deviceScaleFactor: config.pdfDeviceScaleFactor,
        landscape: false,
        width: ctx.query.width,
        height: ctx.query.height,
        timeout: 1000 * 60 * 2,
    })
ReLater commented 1 year ago

As far as I see Opera 90.0.4480.84 (current) on Windows 10 doesn't suppot hyphens yet. It's always loading de.wasm file in my test scenario while it doesn't use hyphens rules in CSS when I deactivate my Hyphenopoly plugin.

Arkkimaagi commented 1 year ago

Until this chart is all green, (and probably beyond that for special things like headless) I see a great need for this project.

This project is a saviour for Finnish layout woes. Truly appreciated. Thanks!

achmizs commented 11 months ago

The hyphenation that Hyphenopoly does is also better than browser-native hyphenation. I am not aware of any reason to expect existing browser hyphenation to improve anytime soon (the proverbial checkbox having been checked off), so the use case for Hyphenopoly remains, for designers who take typography seriously. Here are a couple of examples from gwern.net, comparing Hyphenopoly to native hyphenation in Chromium on a Mac:

Native: https://share.obormot.net/screenshots/Arcturus_Screen%20Shot%202023-09-25%20at%202.18.01%20PM.png Hyphenopoly: https://share.obormot.net/screenshots/Arcturus_Screen%20Shot%202023-09-25%20at%202.18.39%20PM.png

Native: https://share.obormot.net/screenshots/Arcturus_Screen%20Shot%202023-09-25%20at%202.19.31%20PM.png Hyphenopoly: https://share.obormot.net/screenshots/Arcturus_Screen%20Shot%202023-09-25%20at%202.19.58%20PM.png

Native: https://share.obormot.net/screenshots/Arcturus_Screen%20Shot%202023-09-25%20at%202.22.21%20PM.png Hyphenopoly: https://share.obormot.net/screenshots/Arcturus_Screen%20Shot%202023-09-25%20at%202.22.49%20PM.png

(Safari is marginally better, but still not as good as Hyphenopoly. Firefox is worse.)

achmizs commented 11 months ago

Note that the alternative to Hyphenopoly, for those wanting high-quality hyphenation, is not native browser hyphenation but rather server-side hyphenation, which would leave the rendered page in the same final state as Hyphenopoly does—with soft-hyphen characters inserted at appropriate places in hyphenation-eligible words—but would not have any client-side performance consequences. However, such solutions are more complex to set up and maintain than a client-side approach like Hyphenopoly, and are rarely available in the first place; I know of almost no websites that do this, and the few such setups that I’ve seen, have been bespoke, and fragile as a consequence.

jreed-cartago commented 9 months ago

Hi, if I may I'd like to add my comment to this discussion.

My company, Cartago Software GmbH, builds a web based editor that allows our customers to generate templates for their documents and then during the production process these documents are processed using FOP to generate PDF or HTML or whatever they need. That said we have, in the past, relied on the original project from @mnater Hyphenator to provide the WYSIWYG when it comes to hyphenation. Then when the big reports that browsers would provide native hyphenation support we disabled our editor's use of Hyphenator. That was apparently a bad idea. The hyphenation algorithms inside the various browsers are not supporting the same hyphenation standards as we see in FOP and some of our customers have noticed this.

While investigating our previous use of the Hyphenator project I noticed that it was no longer supported and that the new project is this one Hyphenopoly, and I'm working out how to use it instead of the Hyphenator since I believe (at least I hope) that it will bring our editor functionality inline with the FOP output.

So don't think that there aren't use cases for high quality hyphenation in the browser. So I hope that you don't archive this project too soon.

mnater commented 9 months ago

No, I plan to maintain the project for a long time to come. The move from Hyphenator to Hyphenopoly was a decision that I would make differently today. But I'm constantly learning.

This issue is also primarily about where the focus lies. In fact, in recent years I have seen a shift in applications away from polyfill and towards use as a node module.

As I maintain the project in my spare time, it’s important to be able to use the little time I have in a targeted way.

I am happy about every project that uses Hyphenopoly. Please contact me at any time with problems or suggestions for improvement.

Best regards, Mathias