View Single Post
Old 02-07-2020, 01:59 PM   #748
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by wzyboy View Post
Hi, I would like to share a workaround from my friend, to deal with books with vertical text and/or ruby tags.
...
Strangely, the requirement of dc:language=ja only exists in Kindle Previewer. A Chinese ePub book with vertical text and ruby tags could be converted to KF8 (.azw3) without any issues with KindleGen.
I am curious regarding your interest in converting vertical Chinese books to KFX format. Why not just use KF8? Is there something that the KF8 renderer does not handle properly or that the KFX renderer does better?


Quote:
Originally Posted by wzyboy View Post
So, to support vertifical text and ruby tags in KFX, one should set xml:lang=ja even for non-Japanese books

This hack, however, will result Japanese fonts to be used for non-Japanese books. A custom font should be used to remedy this.

Could we consider add this hack (but maybe not enabled by default) to the KFX output plugin?
I will add an experimental feature to convert vertical Chinese language books in the next KFX Output plugin release.

You will need to add <meta name="primary-writing-mode" content="vertical-rl"/> to the <metadata> section of the OPF to enable vertical text conversion. This is proprietary Amazon Kindle metadata and should be safe to add as it should be ignored by anything else.

When this is present the plugin will change the Chinese language code to Japanese for conversion and then will change it back within the KFX file produced. Doing that will allow conversion to succeed with vertical text and should also allow Chinese font selection in the resulting file.


Quote:
Originally Posted by wzyboy View Post
BTW, calibre currently does not recognize -webkit-writing-mode and -epub-writing-mode and strips these CSS during conversion. So one must use calibre-debug to run KFX Output, instead of using calibre GUI.
...
I have attached a sample Chinese ePub file with vertical text and ruby.
In your example you are applying the class "vrtl" to the <html> element. It seems that calibre does not handle this properly, resulting the the class styling being lost during conversion. I have reported it as a bug to the calibre developer.

In the mean time you can work around the problem by moving the class to the <body> element instead.

Quote:
Originally Posted by wzyboy View Post
After setting the language to "ja" in KFX Output plugin, it could be rendered without issues on Kindle Paperwhite 4.
The roll out of vertical Japanese in KFX is not yet complete. The Kindle for Android and iOS apps support ruby, but the current e-ink Kindle firmware (5.12.3) uses an older version of the KFX renderer which may still have bugs in ruby support.
jhowell is offline   Reply With Quote