mbutterick / typesetting

document-layout tools [mirror of https://git.matthewbutterick.com/mbutterick/typesetting]
https://git.matthewbutterick.com/mbutterick/typesetting
MIT License
33 stars 2 forks source link

Dropped initial ideas #5

Open ergl opened 4 years ago

ergl commented 4 years ago

I'm wondering what's the best way to handle initials, especially dropped initials. For raised initials, I'm basically doing the following, which works "fine":

(q
    (q [(font-size-adjust "300%")] "L")
    (q "orem ipsum dolor sit amet, consectetur adipiscing elit. Mauris semper augue vel ligula convallis, ..."))

For dropped initials, I thought of using the above, combined with font-baseline-shift. The problem with that is that the following text has to reflow accordingly. Looking at mbutterick/quad#37 I see that baseline shift is intended for sub/superscript text, and not this. I wonder if you have any ideas of how this could be supported.

mbutterick commented 4 years ago

Dropped initials (I call them drop caps, but it’s the same thing) are more difficult because a) the top & bottom of the letter want to align with the adjacent text and b) the adjacent text needs to wrap around the letter. Currently Quad has no way to wrap text around objects, and probably won’t for a while (it’s difficult and AFAICT isn’t needed that often in real-world layouts)

Looking at the example below, however, we could imagine a way of approximating a drop-cap wrap by a) indenting the first few lines by a fixed amount and then b) layering the drop cap over the empty space. I’m a little stuck on this one, because though I know how I would express this in Racket (= pass a procedure to the line-wrapper that generates the width of each line) I’m not sure how I would express it in Quad markup (though I’m open to suggestion).

Screen Shot 2020-01-22 at 12 01 40 PM

ergl commented 4 years ago

a) indenting the first few lines by a fixed amount and then b) layering the drop cap over the empty space

Yes, I think this sounds right. From taking a cursory look at how the lettrine latex package does it, you specify the amount of lines you want your initial to cover.

I’m not sure how I would express it in Quad markup

Perhaps having an option like first-line-indent that allows you to indent several lines, instead of just one? Specifying vertical alignment for the initial is more complicated, I'm not sure how to go about that.

mbutterick commented 4 years ago

option like first-line-indent that allows you to indent several lines

My hunch is that it should go the other way: that there should be a general mechanism for setting the wrap width by line, and that first-line-indent then becomes a special case of that mechanism.