Live data from Hacker News

Laying Out a Print Book with CSS

iangmcdowell.com

41–50 of 121 posts

Re: Laying Out a Print Book with CSS

#41
post #24

For those interested in this topic, you might want to checked paged.js https://pagedjs.org/documentation/ It's an polyfil for the unimplemented CSS paged specification, which is exactly that is needed for laying out pages. https://www.w3.org/TR/css-page-3/

I used PagedJS to print many abstract books for conferences — it's worked brilliantly!

Re: Laying Out a Print Book with CSS

#42

This article completely misses the point. Proper typesetting is about achieving a consistent appearance starting from ligatures and kerning, then word spacing and hyphenation, up to entire paragraphs and pages. Each character has to be typeset considering what character came before, how many words are in the same line and other lines in the same paragraph. The choice of font is also questionable, but not the main iss…

> Proper typesetting is about achieving a consistent appearance starting from ligatures and kerning, then word spacing and hyphenation, up to entire paragraphs and pages. I looked into CSS hyphenation because I was curious about controlling hyphenation in ebooks. CSS hyphenation appears to be based around the principle that you manually insert HTML entities representing potential hyphen locations into every word, whi…

It’s crazy, and that’s why hyphenation doesn’t really work that way. Both TeX and web browsers use Liang’s algorithm to split words. [1] It uses so-called patterns, which are short substrings of words in which numbers indicate how to divide the word. For example, the pattern “s1h” indicates that in the word “fishing”, a divider can be inserted between “s” and “h”. Patterns compete and can override each other, and the whole thing is quite complicated. As for your example with Qishan — the “s-h” probably overrides the “i-s” pattern. (There have been a number of articles in TeX journals that explain the algorithm, such as [2].)

In CSS, automatic hyphenation must be explicitly turned on, see [3].

In TeX and in CSS, hyphenation points can be marked explicitly: in TeX with the \- macro and in CSS with the ­ or U+00AD character. In TeX you can also override the automatic division with \hyphenation{}.

The splitting algorithm in CSS is worse than the one in TeX, because it has to work in real time and because (good) splitting patterns are often missing.

[1]: https://www.tug.org/docs/liang/

[2]: https://www.fi.muni.cz/usr/sojka/papers/euro01.pdf

[3]: https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens

Re: Laying Out a Print Book with CSS

#43

This article completely misses the point. Proper typesetting is about achieving a consistent appearance starting from ligatures and kerning, then word spacing and hyphenation, up to entire paragraphs and pages. Each character has to be typeset considering what character came before, how many words are in the same line and other lines in the same paragraph. The choice of font is also questionable, but not the main iss…

I chose to use InDesign to typeset my self-published book, and I have to say the quality it produces from just placing some imported text with no other changes looks 1000 times better than this. It's easy to go down a rabbit hole and start really tweaking the layout but if all you're doing is applying some CSS anyway then you can produce better output with InDesign's defaults in about 5 minutes. I've been writing the book in Google Docs and printing chapters for review as I go, and it's nice to see a physical copy of your work. But I was blown away when I made my first PDF copy with InDesign how much better the typesetting is. It really does feel like a proper book and not an essay that I printed out for a school assignment.

Re: Laying Out a Print Book with CSS

#45
post #29
post #17

One serious problem is that CSS do not support CMYK colors.

Might be a joke, humor can be difficult to convey in forum post form, And I am that stereotypical sort who often does not get humor. But I will bite. It is a printed book... there is no color in the process.

It is not a joke. Color print exists, you know. For example, try obtaining a pure cyan from RGB color...

Re: Laying Out a Print Book with CSS

#47
This is awesome! Jost is a really nice font. Some css i like to add to my fonts to improve readability:

-webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-variant-ligatures: contextual common-ligatures;

Give them a try and let me know if they help :-)

Re: Laying Out a Print Book with CSS

#49
post #22

Earlier quoted context omitted.

yeah, it seems a bit weird to be marketing your techno thriller book with a post about css. I mean I guess there is some overlap between the two subjects, as there is likely be overlap between anything in a world with complicated people.

It. Is. Marketing. The very first sentence is just a link to Amazon to buy the thing.

Yup. Well written enough for me to forget that part. Just enjoyed the post .

Re: Laying Out a Print Book with CSS

#50
post #22

Earlier quoted context omitted.

It. Is. Marketing. The very first sentence is just a link to Amazon to buy the thing.

Yup. Well written enough for me to forget that part. Just enjoyed the post .

The question then is, is it effective marketing? How many sales resulted from this blog post? Zero? A handful? Tens? Hundreds?

I would guess a handful at most.

And I am not saying that to criticise the author. Marketing is genuinely difficult. Hell I even did a marketing campaign with paid ads on Reddit to get more people to use one of my pieces of open source, free of charge, pieces of software and even with a bunch of ad impressions and clicks I can still count the amount of new stars on just a few hands

Post reply on HN