Microtypography and the -bag properties
The engine exposes a handful of controls that plain CSS does not
know. They all carry the -bag- prefix, cascade and inherit like
normal properties, and are safe to leave in stylesheets that are also
used in browsers (unknown properties are ignored there).
Font expansion
Justification usually has only the word spaces to work with. Font expansion (the hz-program idea) additionally lets the glyphs themselves stretch or shrink by a small percentage, which evens out word spacing and helps the line breaker find better breaks. It is on by default at 5%; the percentage is the maximum change of a glyph’s width:
body { -bag-font-expansion: 0%; } /* switch it off */
body { -bag-font-expansion: 2%; } /* more conservative than the default */
At sane values (2 to 5 percent) the distortion is invisible at reading distance; what remains visible is the calmer word spacing.
Line breaker tuning
Two knobs steer the paragraph breaker directly:
blockquote { -bag-linebreak-tolerance: 8; }
th { -bag-linebreak-hyphen-penalty: 200; }-bag-linebreak-tolerance(default 4) is the badness a line may reach before the breaker refuses it. Raise it for very narrow measures (table cells, margin columns) where the default finds no acceptable break and lines come out overfull; the price is looser word spacing.-bag-linebreak-hyphen-penaltymakes hyphenated line ends more expensive. Raise it to hyphenate less without forbidding hyphenation outright (hyphens: nonedoes that); it is the gentler tool because emergencies can still hyphenate.
Reference: all -bag properties
| Property | Effect | Details |
|---|---|---|
-bag-leading-model |
half (CSS, default) or trailing (TeX): where the leading of a line goes. |
Lines and leading |
-bag-font-expansion |
Maximum glyph width change for justification, default 5%. |
this page |
-bag-linebreak-tolerance |
Maximum accepted line badness, default 4. | this page |
-bag-linebreak-hyphen-penalty |
Extra cost of a hyphenated line end. | this page |
-bag-italic-correction |
auto inserts kerns at italic-to-upright boundaries, none (default) does not. |
Letterforms |
-bag-bookmark |
Adds any element to the PDF outline, or removes a heading from it. | PDF bookmarks |
-bag-background-page |
Uses an image or PDF page as the page background in @page rules. |
how-to: letterhead |