Skip to content

Commit

Permalink
Disable EPUB pagination with vertical text (readium#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu committed May 15, 2024
1 parent 0d6efa0 commit 5ee94a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file. Take a look

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

<!-- ## [Unreleased] -->
## [Unreleased]

### Changed

#### Navigator

* 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).


## [3.0.0-beta.1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public class EpubPreferencesEditor internal constructor(
PreferenceDelegate(
getValue = { preferences.scroll },
getEffectiveValue = { state.settings.scroll },
getIsEffective = { layout == EpubLayout.REFLOWABLE },
getIsEffective = { layout == EpubLayout.REFLOWABLE && !state.settings.verticalText },
updateValue = { value -> updateValues { it.copy(scroll = value) } }
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ internal class EpubSettingsResolver(

val theme = preferences.theme ?: Theme.LIGHT

var scroll = preferences.scroll ?: defaults.scroll ?: false

// / We disable pagination with vertical text, because CSS columns don't support it properly.
// / See https://github.com/readium/swift-toolkit/discussions/370
if (verticalText) {
scroll = true
}

return EpubSettings(
backgroundColor = preferences.backgroundColor,
columnCount = preferences.columnCount ?: defaults.columnCount ?: ColumnCount.AUTO,
Expand All @@ -45,7 +53,7 @@ internal class EpubSettingsResolver(
paragraphSpacing = preferences.paragraphSpacing ?: defaults.paragraphSpacing,
publisherStyles = preferences.publisherStyles ?: defaults.publisherStyles ?: true,
readingProgression = readingProgression,
scroll = preferences.scroll ?: defaults.scroll ?: false,
scroll = scroll,
spread = preferences.spread ?: defaults.spread ?: Spread.NEVER,
textAlign = preferences.textAlign ?: defaults.textAlign,
textColor = preferences.textColor,
Expand Down

0 comments on commit 5ee94a2

Please sign in to comment.