Bug 697707 - request for auto hyphenation in epub (enable\disable auto hyphenation)
Summary: request for auto hyphenation in epub (enable\disable auto hyphenation)
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: epub (show other bugs)
Version: master
Hardware: PC Linux
: P4 normal
Assignee: MuPDF bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-30 09:28 UTC by foobnix
Modified: 2025-09-02 20:25 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
sample.png (778.79 KB, image/png)
2017-03-30 09:28 UTC, foobnix
Details

Note You need to log in before you can comment on or make changes to this bug.
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