babluboy / bookworm

A simple ebook reader for Elementary OS
GNU General Public License v3.0
1.33k stars 101 forks source link

Justified and auto hyphenation alignment #111

Open momoe opened 7 years ago

momoe commented 7 years ago

As the title suggests, an option to enable justifed text instead of the default left alignment. Further enabled option to allow auto hyphenation to break words instead of stretching/squashing lines of text to fit the margins.

babluboy commented 7 years ago

@momoe Thanks for this suggestion. At the moment I am not adding any justification control on the rendering of the text so probably something to look into... Also, can you add a screen shot of the issue on how it looks like with the stretching/squashing of the text using the preference control - and a screen shot of how you expect it to look maybe from MS Word justification ?

screenshot from 2017-08-06 12 17 47

momoe commented 7 years ago

@babluboy The issue I'm describing is just off hand found in many typeface applications that use justification there's usually a bit of squashed kerning or elongated spaced words to make words fit the edge of the margins of a page, if hyphenation isn't used. A good example would be to spin up Libre Office and shrink the page down to a narrow format and fill in some justified text. I've posted a screenshot here for example.

Essentially what Auto-hyphenization does is instead of distorting the lines of text to fit the margins, will rather break off any elongated words and continue the later part of it on the next line, leaving minimal distortion.

deepinscreenshot_select-area_20170807035507

babluboy commented 7 years ago

@momoe Many thanks - that gives me a better idea. From a quick search it looks like auto-hyphenization is possible to implement in CSS : https://stackoverflow.com/questions/8937591/is-it-possible-to-enable-auto-hyphenation-in-html-css Will look to reproduce this from a book and then try the CSS to see the effect.

momoe commented 7 years ago

Yes, Auto-hyphentization has been implemented into HTML5 CSS3. https://www.w3.org/International/tests/repo/results/hyphens https://css-tricks.com/almanac/properties/h/hyphenate/

While not a programmer myself, I've dabbled a bit with CSS for ePub formatting, so it would be convienient to have a Preference area to tamper with a user side set of parameters to modify their fields. But that's just my random brainstorming.

And just a follow up on the page display; is it going to be the standard to have the whole of the HTML file loaded as one page, or will it eventually be able to trunicate it based on the window's dimensions? It's been kinda odd scrolling through a large amounts of text, detracting from the 'book' experience.