Bad interaction between bidi and color fonts
See tests/color-fonts.sil. I've disabled the regression test for now so we can get back to passing but this issue is here to track the problem.
@ctrlcctrlv This smells to me like the fix might be similar to the one you did for SVG color fonts in TTB direction (see #1171 and #1172). The offsets used during SVG composition seem to be going the wrong direction much like they were in TTB.

Does this sound like the fix should be similar to what you did?
Yes. I was looking into this @alerque because I think @simoncozens actually, in truth, implemented TTB wrong at a fundamental level vis a vis BiDi.
Consider this patch:
diff --git a/classes/jplain.lua b/classes/jplain.lua
index 02896afd..812b32d9 100644
--- a/classes/jplain.lua
+++ b/classes/jplain.lua
@@ -16,19 +16,12 @@ jplain.defaultFrameset.content = {
function jplain:_j_common ()
self:loadPackage("font-fallback")
self:loadPackage("hanmenkyoshi")
- self:registerPostinit(function (class)
- class:bidiDisableTypesetter(SILE.typesetter)
- class:bidiDisableTypesetter(SILE.defaultTypesetter)
- end)
self.defaultFrameset.content.tate = self.options.layout == "tate"
self:declareHanmenFrame("content", self.defaultFrameset.content)
SILE.settings:set("document.parindent", SILE.nodefactory.glue("10pt"))
if SILE.settings:get("document.language") ~= "ja" then
SU.deprecated("document.language ≠ \"ja\" & jplain:…", nil, "0.13.2", "0.14.0", "Prior to SILE v0.13.2, `jplain`, despite its name, did not enforce the use of Japanese in its documents. To use a class like `jplain` for other languages, please base a *new* custom class off of `jplain`; do not use `jplain` itself. To use `jplain` for Japanese, you *must* specify \\language[main=ja]. This will become a hard error in SILE v0.14.")
--[[ @alerque — Remove these lines post v0.14.0! ]]
- self:registerPostinit(function (_)
- SILE.call("font:add-fallback", { family = "Noto Sans CJK JP" })
- end)
SILE.settings:set("document.language", "ja")
SILE.languageSupport.loadLanguage("ja")
end
diff --git a/languages/ja.lua b/languages/ja.lua
index f5135c30..594ba6f9 100644
--- a/languages/ja.lua
+++ b/languages/ja.lua
@@ -183,5 +183,17 @@ return {
SILE.call("medskip")
end)
- end
+ local class
+ class = SILE.documentState.documentClass
+ if class then
+ class:registerPostinit(function(class)
+ if SILE.typesetter then
+ class:bidiDisableTypesetter(SILE.typesetter)
+ end
+ if SILE.defaultTypesetter then -- this code smells
+ class:bidiDisableTypesetter(SILE.defaultTypesetter)
+ end
+ end)
+ end
+ end,
}
It doesn't work and is covering up highly smelly code.
The fact is, we shouldn't need to disable BiDi in tate. Bilingual RTL/CJK works are very rare, sure, but do exist.
When I was working with pLaTeX I noticed that it demands users insert the macro \rensuji{…} (連数字).
If not, \latin-in-tate behavior is default.
I was able to replicate this in SILE but I got Japanese characters 90° rotated.
I suggest we rotate them back based on jlreq class or Unicode CCC.
I'm getting tired but the full suggestion is:
-
remove
\latin-in-tate - let BiDi run and rotate Japanese, Chinese, Korean, etc characters back after BiDi completion
- intelligently decide to rotate digits up to a maximum of two Latin digits, or any single Latin letter, back
- add a macro
\yoko-chuu-tate縦中横 to do the opposite of the removed\latin-in-tate, mimicking\rensujiin pLaTeX