-
Notifications
You must be signed in to change notification settings - Fork 35
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
Arabic diacritics displaced by kashida.plain transforms #257
Comments
I'm facing several technical issues/limitations and I'm a bit stuck. See for example https://tex.stackexchange.com/questions/686767/process-hbox-with-luaotfload and also harfbuzz/harfbuzz#3762 (comment). Some others are related to the fonts, which sometimes don't seem to take into account the kashida (with clearly misplaced diacritics). I’ll read carefully your looong report (I wish they were all like that 🙂). There are some explanations here:
The horizontal placement of diacritics is under the direct control of |
Thanks! That enables me to make more informed experiments. With the following transformation rules, the horizontal displacement of diacritcs is solved using 1-letter rules:
But in the output, the kashida is displaced vertically: |
.. so the y-axis-offset should, that results from lifting diacritics, should be reset before inserting kashida (and maybe restored afterwards).---I can't guarantee, that this is a TeX-like formulation of a fix... |
Diacritics (vowels) should keep their horizontal position above the consonant they refer to. The old kashida insertion rule displaced them horizontally, because kashidas were inserted between the diacritic and the consonant they belong to. See latex3#257. These rules work for one or two diacritics on a consonant.
I order make the change as small as possible, the reset is only performed, if the preceding node is a character---and not a diacritic mark. See latex3#257.
With the changes from my
If you would rather keep the Should I open a PR? |
Hm, with other fonts in still get bad results where the kashida is shifted above the baseline for some character combinations. |
I'm somewhat busy right now. Allow me a week or so. |
…itics When a kashida is inserted behind a diacritics, the diacritic's glyph is not the node which should be used for creating the kashida's node (by copying), but the character's node. Copying the diacritic's node results in x and y offset, which displace the kashida. By copying the node of the character (on which the diacritic is placed) or by copying a ghost node we get correct x and y offsets to adapt the kashida smoothly to the character. This feature can be enabled by `\directlua{Babel.arabic.kashida_after_diacritics=true}` or disabled by setting it to `false`. This fixes issue latex3#257. But setting `Babel.arabic.kashida_after_diacritics` from the name of the transformation rules would be great.
@jbezos No problem! Sorry for mixin in #243 and writing such a cumulative issue. Also my I managed to get very fine results in the meantime. In order to leave By default, the logic of kashida insertion is unchanged. Only with This is the result I get with And this is the result I get with New cases 5 and 6:
|
Thanks. I’m reading the code and there is a point that can mislead and should be clarified. FreeSerif doesn’t use the PUA, but |
I’ll work on some of your ideas. The new transform can be useful in ‘plain’ fonts, not involving ligatures, but with the latter it’s still an unsolved issue, except by creating rules specific to a font. For the JALT table I devised a hack based on parsing twice some frequent cases, with the normal form and the elongated one, but it’s basically a proof of concept that can’t go very far (and it only works with Sakkal Majalla, and not quite – again diacritics is the problem). The vertical positioning of tashkil is not (usually) fixed, and they are shifted by the font depending on the character. I was working on something similar to the JALT variants to catch the correct |
Your transform are now available (in version 3,94), with name https://latex3.github.io/babel/news/whats-new-in-babel-3.94.html#new-transform-for-kashida |
Thanks for your great effort on the kashida feature! I know, that
it's still in experimental state. I'd like to point to some issues.
Here's a MWE with an analytic tool for investigating the input
characters (for helping people like me who have to typeset Arabic but
can't read it). It uses
\makebox[LENGTH][s]{TESTCASE}
for forcingkashida elongation on single words for demonstration.
TEX engine: LuaHBTeX, Version 1.17.0 (TeX Live 2023)
babel version: 2023/08/09 v3.92.22182 The Babel package (from github)
The output per test case is (from right to left): Number, input, expecation, result (box).
displaced horizontally from the letters (consonants) by
kashidas. As far as I know, the FATHA (U+064e) should stay above
the consonant instead of being deferred to the left. The kashida
should be inserted after all the diacritics that belong to a
consonant.
I tried to fix this by changing
to
where the second
()
is moved behind the regex for the diacritics[]*
. But this makes the diacritic disappear, when a kashida isinserted behind the consonant the FATHA refers to.
I also tried special rules for consonant+vowel combinations like
But again, the effect is that the FATHA disappears. So, I guess, we
need 2-letter and 3-letter rules for getting this right. Somehow like
below, but I don't know the syntax for 2 and 3 letter rules.
prevent further elongation. I think this is like Allow manually inserted tatweel to stretch with Arabic kashida #243.
This can be fixed by adding the kashida into the first regex character class:
@amarakon would like to see it in Allow manually inserted tatweel to stretch with Arabic kashida #243, we could drop it in a
1-letter rule (the same way that makes the diacritic go away in my
attempts):
try this which makes diacritics go away (too bad!) and kashidas homogenous:
ArabicTypesetting
, I get kashidas at the end of a word for some letters.Could you point be to a documentation of transformation rules?
The text was updated successfully, but these errors were encountered: