-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): Implement hangafter/hangindent + dropcaps package #1219
feat(core): Implement hangafter/hangindent + dropcaps package #1219
Conversation
3fecf31
to
4bb4a45
Compare
I'm putting off reviewing and merging this until after the current release cycle because we have an issue with feature creep and can't get everything together for a good release if we don't draw some boundaries. I will not be opposed to an early follow up with whatever new features and fixes we have lined up after that, and this is very high of my personal list of wants/needs. |
Whew. Goodbye math, safe voyages. Hello there my old |
4bb4a45
to
3169ebf
Compare
This implementation has some great sides, but I'm going to combine it with one of mine before merging. The split between core shaping issues vs. dropcap package issues is a good one, and that is much better than any iteration I have cooked up. From my implementations though I have some measurement stuff that I think is a little more robust, a function to trigger the "next" paragraph to have a dropcap without needing to split out the character in markup yourself, and a few other tweaks. I'm posting partial work on this because my brain is going fuzzy and I need to put it to bed. |
3169ebf
to
dab862a
Compare
@Omikhleia Can you have another look at this? Other than splitting up the commits a bit I left your hangAfter/hangIndent implementation alone entirely. On the other hand I basically rewrote the dropcaps package in a75009c. It functions roughly the same way, but I changed to just two cycles creating hboxes, the second one being the final shape. What is being measured changed just a bit along the way (using the requested dropcap font for placement metrics, not the paragraph) but I think it makes sense. I also re-used some APIs that exist (rebox, lower) to achieve the same affect in perhaps a more understandable way for anybody that tries to copy and modify the code. Besides that I moved the example to the website and cleaned it up a bit for that context, and I pared down the test a bit to be closer to a unit test. |
dab862a
to
d7b0940
Compare
Force push right now took care of a Lua lint issue. The remaining test failures have to do with this being branched before some changes to the CI font caching. Even though I merged from master into this, the way the GH Actions are setup the fonts are cached for test runs on the PR. I think this will be okay, but if not I'll take care of that separately. |
I just took yet another pass at this in f31438d. This time I moved the content of the initial itself from an argument to the command to the content itself. The rest of the paragraph can just be typeset as usual afterwards. This makes it a bit easier to integrate into other systems and contexts I think. |
My last couple commits have added some additional features so this can be customized in more ways. Just for reference, here is where we are at (from the website example PR):
|
In order to work as expected in my redesigned usage (passing the initial letter content as the function content and letting the rest of the paragraph follow naturally) this will need to change to reset itself much like paragraph indent does when you change the current paragraph setting. |
@alerque Looks great, and the extra options are most welcome. The case for leading punctuation is impressively cool. I'll try to have a closer look and test as soon as I can (might be hard before the end of the week, some tough days to come ^^) |
* Remove arbitrary single letter restriction: In some languages and publishing traditions, punctuation is frequently included in the drop cap content. * Rename \dropcaps function to \dropcap * Rename ‘letter’ option to ‘initial’ to reflect usage, may be arbitrary content. * Pass options through to font * Scale based on size of dropcap font, not original * Optimize code for readability, speed, and re-using existing functions * Don't force leaving horizontal at the end, may be used on partial content * Rename joined to join (as previously documented but not coded).
822c485
to
a16d081
Compare
@Omikhleia No worries. I'm going to use this is a book project soon and I try to make sure there is a stable SILE release to match, but this week is just ISBN application and I don't expect to go to press before next week. I'll try to hold off stuffing this in a release until you get a chance to review. By the way you might check your email from a couple days back for special invitation notices from GitHub ;-) |
0eab53e
to
d042bcf
Compare
@Omikhleia and @simoncozens The function provided here is |
c198b0c
to
8db784d
Compare
Sorry to notice it that late - but this change, if the dropcap is in the main document, breaks any inserts (e.g. footnote if present in the paragraph with a dropcap, folio if a pagebreak occurs in that paragraph) as they inherit the document settings since 3795a4e |
Hmmm, my current production project has both situations in the wild (footnotes in first paragraph with dropcap) and pagebreak in the first paragraph. I don't see this issue there, do you mean when both those situations are true? |
One or the other, not necessarily at the same time.
|
Ah hah! My production project uses CaSILE's implementation of footnotes, not SILE's. This is a function of your recent contributions to SILE's footnotes package, the typesetter of which is now inheriting settings from the document scope. That worked pretty nicely for font family and relative size treatments, but it looks like it is a bit aggressive. We need to either blacklist some settings it should typically not inherit or whitelist the ones it should. |
For now I added a blacklist for core settings that users are pretty unlikely to expect to carry over to footnotes. This isn't an ideal implementation because it is in the footnote package and hence any new packages that come along that might have inappropriate settings won't be able to extend this easily. I have to wonder if perhaps the defaults array might be a better source for footnote settings rather than the top level document settings. Only if people explicitly mark their settings as default would they get inherited. In any event that fix can go in another PR. |
Hm, folios needs the same fix. |
d4540d4
to
2765e8c
Compare
2765e8c
to
1b8bffb
Compare
Greetings,
This PR is an implementation for the idea I mentioned in #1218, as an alternative for implementing initial capitals (drop caps) without using float frames.
I haven't noticed anything broken in my tests (though limited), but this certainly has to be reviewed and checked with both eyes wide open. Hence the PR, if anyone wants to play with it. - not necessarily to check drop caps, but also to ensure there's no hiccup on normal documents.
As a by-product of this hangafter/hangindent, I have included:
drocaps
package per se, with an example (in the "examples" directory). It works by:N.B. As opposed to TeX, the hangafter is not reset at the start of a new paragraph (but being implemented via settings, it's easy to set only temporarily).