Bug 697707

Summary: request for auto hyphenation in epub (enable\disable auto hyphenation)
Product: MuPDF Reporter: foobnix <ivan.ivanenko>
Component: epubAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: sample.png

Description foobnix 2017-03-30 09:28:44 UTC
Created attachment 13512 [details]
sample.png

I would like to request to support word wraping for epub books.
It's better to read books with good text formatting
all lines with same length is better view
It would be good to enable-disable this feature.
Comment 1 foobnix 2017-04-15 01:50:35 UTC
Here is example .js library for hyphenation https://github.com/mnater/Hyphenator with patters for all Languages

here is java sample with the same patterns
https://github.com/bluejamesbond/TextJustify-Android/blob/master/library/src/main/java/com/bluejamesbond/text/hyphen/DefaultHyphenator.java

I think C lang should be very similar.

MuPDF can make hyphenation only for the last word in the line, for better speed.

It would be very good if you can make beautiful text formatting for all languages.
Comment 2 Tor Andersson 2025-09-02 20:25:04 UTC
The following commit adds automatic hyphenation support to the HTML/EPUB engine.

For it to be used the document needs to set the language (lang="en" for example) and
enable auto hyphenation via css (hyphens: auto).

Test with this example document:

    <!doctype html>
    <html lang="en">
    <body style="hyphens:auto">
    <p style="width:10px">
    Supercalifragilisticexpialidocious.


commit 9fbcc07343d168d0943dc1cdd5eed7b2b98bea34 (HEAD -> hyphen, tor/hyphen, origin/master, origin/HEAD)
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Mon Aug 18 23:52:25 2025 +0200

    html: Add hyphenation support.
    
    Use hyphenation tables from TeX distribution.hy