4 ms·
Where are word breaks (word splitting if not fit for page), justify alignment? Variable spaces between letters? Is this possible with CSS? I'm trying to typese
by hoschicz 10y ago
Where are word breaks (word splitting if not fit for page), justify alignment? Variable spaces between letters?
Is this possible with CSS? I'm trying to typeset a long text on the web and I'm not happy about how it looks compared to LaTeX and PDF. (it's straight out awful)
- matthewmacleod 10y agoThe CSS text module has some support for various text manipulations (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Text https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Text) but it's obviously not quite as extensive as LaTeX or InDesign or whatever.
- mcbetz 10y agoUnfortunately, `hyphens: auto;` is still not supported on Chrome Windows. I still recommend using it, as it brings nicer layout to the ones you can see it (http://caniuse.com/#search=hyphens http://caniuse.com/#search=hyphens) and does not break the layout for others. CSS Text 4 drafts might bring massive improvements for text handling and will give more fine grained controls over hyphenation, such as `hyphenate-limit-lines` (https://drafts.csswg.org/css-text-4/#hyphenate-line-limits https://drafts.csswg.org/css-text-4/#hyphenate-line-limits), but obviously this is nothing that will make it to stable browsers in the near future. Still, the changes that might come for CSS with this draft would bring it a lot closer to LaTeX or InDesign.
- e12e 10y agoI find it sad that what has been holding this back for years is "how will we download dictionaries": https://bugs.chromium.org/p/chromium/issues/detail?id=605840 https://bugs.chromium.org/p/chromium/issues/detail?id=605840 Especially considering LaTeX had this right for decades - and it is one of the major issues for good and pleasant readability... sigh.
- deathanatos 10y agoI don't even understand their logic here: > Linux and Windows don't have built-in dictionaries. Every Linux distribution I've ever been on has had a dictionary. I'm not sure what package it's in, but the point is that packages exist, and can be depended on (or, although I dislike this, vendored in). (Is it perhaps that they need a dictionary with the syllabic breakdown of the word? IDK if the normal dictionaries will give you that, or if it can be computed or heuristically determined?) (Edit: e.g., on Ubuntu, the "text" category includes a number of dictionaries in various languages … http://packages.ubuntu.com/xenial/text/ http://packages.ubuntu.com/xenial/text/ )
- lotsofcows 10y agoNormally /usr/share/dict/words Def on my Mac and CentOS boxes. Package is words.noarch for the latter.
- mxfh 10y agoThe justified alignment looks sub-par in places, like in the middle of the first paragraph of the example pages. Flush left alignment normally is the better option, if you don't have a hyphenation engine. Browser inserted Soft-Hyphens could fix this, but since they are language dependent browser support is spotty: https://developer.mozilla.org/en/docs/Web/CSS/hyphens#Suggesting_line_break_opportunities https://developer.mozilla.org/en/docs/Web/CSS/hyphens#Sugges... By itself most browsers can break soft-hyphens pretty reliable, but they have to be generated first: See https://github.com/mnater/Hyphenator https://github.com/mnater/Hyphenator or https://github.com/bramstein/hypher https://github.com/bramstein/hypher
- NoGravitas 10y agoIt really baffles me that some formatting engines require that soft-hyphens be pre-inserted. For eBooks, particularly. Apparently Kindle supports hyphenation only if the book has explicit soft-hyphens. Google Books doesn't seem to support it at all. Meanwhile, FBReader does a perfect job of hyphenating arbitrary ePubs. TeX has done it right since what, 1983? Yes, hyphenation is language-specific, but if your application is laying out blocks of text, a set of hyphenation tables is a basic part of language support.