Comments (11)
you don't need a vaiable: just apply the modified style to paragraphs that have 'lang="ja"' - which can be hinerithed from html itself.
in the css the selctor can be
[yourtag]:lang(ja) { css declarations;}
You shall also be able to set the text vertical: top to bottom then right to left.
Setting the correct language shall also help the reader to choose the right dictionary.
from blitz.
Thanks, that's a good way to style paragraph elements for a specific language.
But what I'm asking about is adding a way to standardize the bottom margins on all elements, including headings, tables, lists, and paragraphs.
from blitz.
I'm not proficency on FreindsOfEpub styles, but the standard css would be:
* { /* select everything - you could use *:lang(ja) to apply the style only to Japanese*/
text-indent: 0; /* remove any indentation */
margin-bottom: 1em; /* add a bottom margin ( I used 1em, you may choose your distance and units)*/
}
from blitz.
never tested, but for vertical it should be:
*:lang(ja) {
writing-mode: vertical-rl;
}
Do not forget to tag your texts as Japanese
<p lang="ja">はりねずみ</p>
or even the full HTML
from blitz.
But what I'm asking about is adding a way to standardize the bottom margins on all elements, including headings, tables, lists, and paragraphs.
There is a rhythm()
mixin available, whose doc entry is:
.rhythm(@ font-scale, @ margin-top, @ margin-bottom)
Computes a font-size, a line-height and vertical margins for the element. Unlike .fs (@ font-scale), it enforces vertical rhythm.
The @ font-scale argument must be an integer (zero, positive or negative) telling which step in the typographic scale the element should use.
The @ margin-top and @ margin-bottom arguments can be an integer or a decimal (zero or positive) telling the number of lines which should be used for those margins.
It’s used in typo.less for instance:
Blitz/Blitz_framework/LESS/base/typo.less
Lines 53 to 60 in 5dade12
It is meant to recompute the proper em
value for margins depending on the font-size
of the element, and 1 line = 1 line-height
– because some apps don’t support rem
properly so we can’t use it.
It’s probably usable for this normalisation but may end up being a little bit verbose as you’ll have to handle all elements you want to cover in CSS selectors. That said, I don’t necessarily see another option, given ems
depends on the font-size
.
from blitz.
@andrearicci Have you tested the paragraph styles with lang on Amazon devices and apps?
I tried the following CSS on a Japanese document.
p:lang(ja) {
text-indent: 0;
margin-bottom: 1em !important;
}
Works: iBooks on MacOS Mojave
Does not work: Kindle Previewer 3.34 on MacOS, sideloading as AZK onto iOS, Kindle Mac App
from blitz.
@ptmkenny Hi, actually I'm just a CSS hobbist with a Japanese wife. I've not that experience. My wife says that all the Japanese novels she reads on the kindle are vertically formatted. But I can't tell you how.
I can give you a link to free Japanese novel, where you can download some samples and check their CSS. (This is the publisher that you can download for free on amazon.jp).
https://www.aozora.gr.jp/
by category
alphabetical order
Good luck
from blitz.
@andrearicci Ok, thanks. I can do vertical formatting; that is not the problem.
The issue is that the Amazon ecosystem apparently does not support lang-specific CSS.
from blitz.
Out of curiosity, do your elements have both xml:lang
and lang
attributes? E.g.
<html xml:lang="ja" lang="ja">
Reminds me of the issue with nav list you committed a few days ago, with Kindle ignoring the CSS namespace.
And there are like 2 options here:
- Kindle is handling XHTML as HTML (and CSS epub namespace +
xml:lang
fail in this context) - They are simply ignored during conversion.
Answering to myself: so yeah, it looks like :lang()
will fail if you only have xml:lang
set, and you need a lang
attribute as well.
from blitz.
After some debugging, I found the root cause of this issue: pandoc, which I was using to generate the ebook file, was not applying the lang tag correctly even though I had specified it correctly in a YAML block. This has been fixed from pandoc 2.8.1.
The reason why it worked in iBooks but not in Kindle is that iBooks reads the language attribute (not lang, language) in the meta info of the epub.
I'm going to leave this issue open as a reminder to come up with a good example of code of how to do this.
from blitz.
Given the Blitz project is under an “End of Life process”, this issue has been frozen, labeled documentation
and wontfix
, and won’t be addressed any further. Please check #66 for more details.
from blitz.
Related Issues (20)
- Feedback and Support HOT 3
- Portrait/full page image styling HOT 2
- small-caps text-tranform HOT 4
- figure page-break avoid causing issues on kindle HOT 8
- Review + test break-before and break-after HOT 1
- Consider removing AccessibilityAPI and AccessibilityControl from Template metadata, and keep only the essential items HOT 1
- Table cell padding HOT 1
- Consider moving Kindle stylesheet into base
- Consider removing MQ plugin
- Internationalization HOT 1
- Cropped numbers in lists on iPhone HOT 3
- Please tag the 1.4.1 release HOT 1
- Tables: Why is td padding-left only 10px? HOT 3
- Why specify a fixed line height of 1.2 in typo.less? HOT 1
- [Reset] nav ol HOT 2
- Double-check clean-css optimisations HOT 1
- Add visual regression tests for dev HOT 1
- How to have asterisms inherit the text color? HOT 5
- [PSA] Sunsetting Blitz HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blitz.