Skip to content

Commit 95a0ec0

Browse files
committed
Add ruby user submodule
This module allows for the hiding of ruby annotations in CJK. Resolves #140
1 parent 7a84524 commit 95a0ec0

13 files changed

Lines changed: 113 additions & 1 deletion

css/ReadiumCSS-config.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
@custom-selector :--darken-filter [style*="readium-darken-on"];
4545
@custom-selector :--invert-filter [style*="readium-invert-on"];
4646

47+
/* Hiding ruby */
48+
@custom-selector :--no-ruby [style*="readium-noRuby-on"];
49+
4750
/* Accessibility normalization */
4851
@custom-selector :--a11y-normalize [style*="readium-a11y-on"];
4952

css/dist/cjk-horizontal/ReadiumCSS-after.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,11 @@ screen and (min-device-width: 36em) and (max-device-width: 47em) and (orientatio
370370
font-variant:none;
371371
}
372372

373+
:root[style*="readium-advanced-on"][style*="readium-noRuby-on"] body rt,
374+
:root[style*="readium-advanced-on"][style*="readium-noRuby-on"] body rp{
375+
display:none;
376+
}
377+
373378
:root[style*="readium-advanced-on"]{
374379
--USER__typeScale:1.2;
375380
}

css/dist/cjk-vertical/ReadiumCSS-after.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@ body{
351351
font-variant:none;
352352
}
353353

354+
:root[style*="readium-advanced-on"][style*="readium-noRuby-on"] body rt,
355+
:root[style*="readium-advanced-on"][style*="readium-noRuby-on"] body rp{
356+
display:none;
357+
}
358+
354359
:root[style*="readium-advanced-on"]{
355360
--USER__typeScale:1.2;
356361
}

css/src/ReadiumCSS-after-cjk-horizontal.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
@import "modules/user-settings-submodules/ReadiumCSS-lineHeight_pref.css";
1414
@import "modules/user-settings-submodules/ReadiumCSS-paraSpacing_pref.css";
1515
@import "modules/user-settings-submodules/ReadiumCSS-letterSpacing_pref.css";
16+
@import "modules/user-settings-submodules/ReadiumCSS-ruby_pref.css";
1617
@import "modules/ReadiumCSS-fs_normalize.css";

css/src/ReadiumCSS-after-cjk-vertical.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
@import "modules/user-settings-submodules/ReadiumCSS-lineHeight_pref.css";
1313
@import "modules/user-settings-submodules/ReadiumCSS-paraSpacing-vertical_pref.css";
1414
@import "modules/user-settings-submodules/ReadiumCSS-letterSpacing_pref.css";
15+
@import "modules/user-settings-submodules/ReadiumCSS-ruby_pref.css";
1516
@import "modules/ReadiumCSS-fs_normalize.css";
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Readium CSS
2+
Ruby display pref
3+
4+
A submodule managing the display of ruby text for user settings
5+
Part of “User Overrides Advanced” class – “advanced settings” flag required.
6+
7+
Repo: https://github.com/readium/readium-css */
8+
9+
:root:--advanced-settings:--no-ruby body rt,
10+
:root:--advanced-settings:--no-ruby body rp {
11+
display: none;
12+
}

docs/CSS11-overrides_classification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The following settings are optional but should be applied by any means necessary
4545
- letter-spacing;
4646
- word-spacing;
4747
- arabic ligatures;
48+
- hiding ruby (CJK);
4849
- accessibility normalization;
4950
- type scale.
5051

docs/CSS12-user_prefs.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ Override class: User settings advanced (optional but should be applied by any me
159159

160160
To disable the normalization, you can either set an empty string as a value or remove the property.
161161

162+
### Hiding Ruby Text
163+
164+
Users may want to hide ruby annotations for accessibility reasons.
165+
166+
```
167+
--USER__no-ruby
168+
```
169+
170+
Supported value: `readium-noRuby-on`
171+
172+
Required flag: `--USER__advancedSettings: readium-advanced-on`
173+
174+
Override class: User settings advanced (optional but should be applied by any means necessary if provided to users)
175+
176+
To disable the hiding and show ruby annotations, you can either set an empty string as a value of remove the property.
177+
162178
## List of variables
163179

164180
### Layout
@@ -456,6 +472,10 @@ User settings to disable are:
456472
- `--USER__paraIndent`;
457473
- `--USER__wordSpacing`.
458474

475+
User settings to add are:
476+
477+
- `--USER__noRuby`.
478+
459479
Finally, `--USER__letterSpacing` should be treated as an exception. We are aware it can be useful in Japanese, but don’t know what the situation is as regards Chinese and Korean. **It’s up to implementers to decide whether it should be enabled or disabled for each of these languages.**
460480

461481
#### Vertical writing mode
@@ -470,4 +490,8 @@ User settings to disable are:
470490
- `--USER__paraIndent`;
471491
- `--USER__wordSpacing`.
472492

493+
User settings to add are:
494+
495+
- `--USER__noRuby`.
496+
473497
Finally, `--USER__letterSpacing` should be treated as an exception. We are aware it can be useful in Japanese, but don’t know what the situation is as regards Chinese and Korean. **It’s up to implementers to decide whether it should be enabled or disabled for each of these languages.**

docs/CSS19-api.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,22 @@ It impacts font style, weight and variant, text decoration, super and subscripts
198198

199199
* * *
200200

201+
```
202+
:--no-ruby
203+
```
204+
205+
Preset: `--USER__noRuby: readium-noRuby-on`
206+
207+
Scope: `html`
208+
209+
Required flag: `:--advancedSettings`
210+
211+
Override class: User settings advanced (optional but should be applied by any means necessary if provided to users)
212+
213+
This will hide ruby annotations i.e. `rt` and `rb`.
214+
215+
* * *
216+
201217
**Warning:** if you customize those flags, all ReadiumCSS `dist` stylesheets must be rebuilt.
202218

203219
## Reading System Styles

docs/ReadiumCSS_docs.epub

202 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)