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
ligatures interupts colors #153
Comments
Thank you for noticing this. We declare it as a feature that ligatures cannot fall apart when there is a color change inside them. I'll try to formulate this in the documentation. The reason is: we want to keep simplicity and a solution of this issue goes against this principle. User have to break the the ligature by own doing, for example by |
Rereading my ticket, I wasn't very clear. I agree that colors should not break ligatures. I was wondering if there is any way to color a glyph only partially if it is part of a ligature, maybe it is possible to pass the information about colors to the ligatures forming process. But, I mainly opened this ticket for the documentation, so I'll close. Thank you. |
Your question is: is it possible to color a letter partly? The "letter" can be a ligature or a common letter. We can do this by PDF primitive for clipping path. The following code sets the red color to the A letter only partly:
|
Just for future reference:
In theory, color is a different style, so it should prevent ligatures, similarly to for example how a switch to bold or italic would. However as mentioned in the linked article, sometimes color is special cased, because naturally we perceive it differently, especially with latin scripts. Here is a more complex example that has no nice solutions: https://faultlore.com/blah/text-hates-you/#style-can-change-mid-ligature. The technical reason why color isn't taken into account while ligaturing is, that we use LuaTeX attributes, and no code takes our color attribute into account. We maybe could implement colors differently, and force the split of text runs at color changes (e.g. font changes do), but as hinted above, it may not even be what we want. I don't know what brought you to investigate the issue, but question at Stack Exchange seems interestingly related: https://tex.stackexchange.com/questions/477143/losing-ligatures-when-switching-font-series-or-color-in-the-middle-of-a-word. |
Thanks for the suggestion, I always appreciate seeing how you use literarls. I guess that if the ligatures are formed by luaotfloade, I'll have to add some code to the
Yes, this is mostly why I opened the ticket, I was just surprised that this fact wasn't documented in OpTeX as well.
Very interesting, Thanks!
see https://tex.stackexchange.com/a/699207/264024 for an example. In hebrew, although punctuation marks never overlap, or connected to the base character, it is often combined into a ligature with the base letter to correct the positioning. By the way, @vlasakm if you will read the linked post, do you know what is the meaning of char number outside the unicode range? I know that at this stage, luaotfload can assign nodes glyph ID's instead of unicode, and that these numbers can depend on whether you use harfbuzz or the default shaping method and maybe even the font, but I did not understand how these numbers are calculated. |
In ConTeXt font processing code (i.e. what luaotfload calls the In your code you use luaotfload with harfbuzz (the See: latex3/luaotfload#198 Do any of these functions luaotfload manual, section 11.2.1 Font Properties help with the (reverse) mapping? I am getting confused by the slot / gid names and not sure if it is relevant. Anyways, this seems out of my area of expertise, I suggest luaotfload github or in specific cases the |
consider the following document:
as you can see, the
i
does not get colored. The reason is quite obvious, the color mechanism sees the ligature only at ship-out time, there for it cannot break the ligature (like implementations using whatsits do). I don't know if there is a simple fix for that (maybe the ligature forming process should be colors aware?), but it might be worth documenting this until, or if it will be changed.Here is an example where the ligature is interrupted:
The text was updated successfully, but these errors were encountered: