Skip to content

Commit 5ee94a2

Browse files
authored
Disable EPUB pagination with vertical text (readium#517)
1 parent 0d6efa0 commit 5ee94a2

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file. Take a look
44

55
**Warning:** Features marked as *experimental* may change or be removed in a future release without notice. Use with caution.
66

7-
<!-- ## [Unreleased] -->
7+
## [Unreleased]
8+
9+
### Changed
10+
11+
#### Navigator
12+
13+
* EPUB: The `scroll` preference is now forced to `true` when rendering vertical text (e.g. CJK vertical). [See this discussion for the rationale](https://github.com/readium/swift-toolkit/discussions/370).
14+
815

916
## [3.0.0-beta.1]
1017

readium/navigator/src/main/java/org/readium/r2/navigator/epub/EpubPreferencesEditor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public class EpubPreferencesEditor internal constructor(
329329
PreferenceDelegate(
330330
getValue = { preferences.scroll },
331331
getEffectiveValue = { state.settings.scroll },
332-
getIsEffective = { layout == EpubLayout.REFLOWABLE },
332+
getIsEffective = { layout == EpubLayout.REFLOWABLE && !state.settings.verticalText },
333333
updateValue = { value -> updateValues { it.copy(scroll = value) } }
334334
)
335335

readium/navigator/src/main/java/org/readium/r2/navigator/epub/EpubSettingsResolver.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ internal class EpubSettingsResolver(
2828

2929
val theme = preferences.theme ?: Theme.LIGHT
3030

31+
var scroll = preferences.scroll ?: defaults.scroll ?: false
32+
33+
// / We disable pagination with vertical text, because CSS columns don't support it properly.
34+
// / See https://github.com/readium/swift-toolkit/discussions/370
35+
if (verticalText) {
36+
scroll = true
37+
}
38+
3139
return EpubSettings(
3240
backgroundColor = preferences.backgroundColor,
3341
columnCount = preferences.columnCount ?: defaults.columnCount ?: ColumnCount.AUTO,
@@ -45,7 +53,7 @@ internal class EpubSettingsResolver(
4553
paragraphSpacing = preferences.paragraphSpacing ?: defaults.paragraphSpacing,
4654
publisherStyles = preferences.publisherStyles ?: defaults.publisherStyles ?: true,
4755
readingProgression = readingProgression,
48-
scroll = preferences.scroll ?: defaults.scroll ?: false,
56+
scroll = scroll,
4957
spread = preferences.spread ?: defaults.spread ?: Spread.NEVER,
5058
textAlign = preferences.textAlign ?: defaults.textAlign,
5159
textColor = preferences.textColor,

0 commit comments

Comments
 (0)