Skip to content

Commit

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

* The `Link` property key for archive-based publication assets (e.g. an EPUB/ZIP) is now `https://readium.org/webpub-manifest/properties#archive` instead of `archive`.

#### 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-alpha.1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ public final class EPUBPreferencesEditor: StatefulPreferencesEditor<EPUBPreferen
preference: \.scroll,
setting: \.scroll,
defaultEffectiveValue: defaults.scroll ?? false,
isEffective: { [layout] _ in layout == .reflowable }
isEffective: { [layout] in
layout == .reflowable && !$0.settings.verticalText
}
)

/// Indicates if the fixed-layout publication should be rendered with a
Expand Down
14 changes: 11 additions & 3 deletions Sources/Navigator/EPUB/Preferences/EPUBSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public struct EPUBSettings: ConfigurableSettings {
?? language?.verticalText(for: readingProgression)
?? false

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
}

self.init(
backgroundColor: preferences.backgroundColor,
columnCount: preferences.columnCount
Expand Down Expand Up @@ -157,9 +167,7 @@ public struct EPUBSettings: ConfigurableSettings {
?? defaults.publisherStyles
?? true,
readingProgression: readingProgression,
scroll: preferences.scroll
?? defaults.scroll
?? false,
scroll: scroll,
spread: preferences.spread
?? Spread(metadata.presentation.spread)
?? defaults.spread
Expand Down

0 comments on commit 356caa8

Please sign in to comment.