Skip to content

Commit 165440b

Browse files
committed
Merge branch 'main' into develop
2 parents 60aa620 + 36f4151 commit 165440b

23 files changed

+601
-5
lines changed

CHANGELOG.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,22 @@ All notable changes to this project will be documented in this file. Take a look
8787
* `Publication.localizedTitle` is now optional, as we cannot guarantee a publication will always have a title.
8888

8989

90+
## [2.7.4]
91+
92+
### Fixed
93+
94+
* [#489](https://github.com/readium/swift-toolkit/issues/489) Fix crash related to Fuzi when compiling with Xcode 16 in release mode.
95+
96+
#### Navigator
97+
98+
* [#502](https://github.com/readium/swift-toolkit/issues/502) Fixed accessibility editing actions on iOS 18.
99+
100+
90101
## [2.7.3]
91102

92-
* [#483](https://github.com/readium/swift-toolkit/issues/483) Fix build on Xcode 16.
103+
### Fixed
104+
105+
* [#483](https://github.com/readium/swift-toolkit/issues/483) Fixed build on Xcode 16.
93106

94107

95108
## [2.7.2]
@@ -774,6 +787,7 @@ progression. Now if no reading progression is set, the `effectiveReadingProgress
774787
[2.7.1]: https://github.com/readium/swift-toolkit/compare/2.7.0...2.7.1
775788
[2.7.2]: https://github.com/readium/swift-toolkit/compare/2.7.1...2.7.2
776789
[2.7.3]: https://github.com/readium/swift-toolkit/compare/2.7.2...2.7.3
790+
[2.7.4]: https://github.com/readium/swift-toolkit/compare/2.7.3...2.7.4
777791
[3.0.0-alpha.1]: https://github.com/readium/swift-toolkit/compare/2.7.1...3.0.0-alpha.1
778792
[3.0.0-alpha.2]: https://github.com/readium/swift-toolkit/compare/3.0.0-alpha.1...3.0.0-alpha.2
779793
[3.0.0-alpha.3]: https://github.com/readium/swift-toolkit/compare/3.0.0-alpha.2...3.0.0-alpha.3

Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
github "cezheng/Fuzi" ~> 3.1.0
21
github "dexman/Minizip" ~> 1.4.0
32
github "krzyzanowskim/CryptoSwift" ~> 1.8.0
43
github "ra1028/DifferenceKit" ~> 1.3.0
4+
github "readium/Fuzi" ~> 3.1.4
55
github "readium/GCDWebServer" ~> 4.0.0
66
# There's a regression with 2.7.4 in SwiftSoup, because they used iOS 13 APIs without bumping the deployment target.
77
github "scinfu/SwiftSoup" == 2.7.1

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ let package = Package(
2323
.library(name: "ReadiumAdapterLCPSQLite", targets: ["ReadiumAdapterLCPSQLite"]),
2424
],
2525
dependencies: [
26-
.package(url: "https://github.com/cezheng/Fuzi.git", from: "3.1.0"),
2726
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.8.0"),
2827
.package(url: "https://github.com/marmelroy/Zip.git", from: "2.1.0"),
2928
.package(url: "https://github.com/ra1028/DifferenceKit.git", from: "1.3.0"),
29+
.package(url: "https://github.com/readium/Fuzi.git", from: "3.1.4"),
3030
.package(url: "https://github.com/readium/GCDWebServer.git", from: "4.0.0"),
3131
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.7.0"),
3232
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.15.0"),

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[Readium Mobile](https://github.com/readium/mobile) is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin.
44

5-
:point_up: **Take a look at the [guide to get started](Documentation/Guides/Getting%20Started.md).** A [Test App](TestApp) demonstrates how to integrate the Readium Swift toolkit in your own reading app.
5+
:point_up: **Take a look at the [guide to get started](docs/Guides/Getting%20Started.md).** A [Test App](TestApp) demonstrates how to integrate the Readium Swift toolkit in your own reading app.
66

77
This toolkit is a modular project, which follows the [Readium Architecture](https://github.com/readium/architecture).
88

@@ -78,6 +78,7 @@ pod 'ReadiumNavigator', podspec: 'https://raw.githubusercontent.com/readium/swif
7878
pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.3/Support/CocoaPods/ReadiumOPDS.podspec'
7979
pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.3/Support/CocoaPods/ReadiumLCP.podspec'
8080
pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/3.0.0-alpha.3/Support/CocoaPods/ReadiumInternal.podspec'
81+
pod 'Fuzi', podspec: 'https://raw.githubusercontent.com/readium/Fuzi/refs/heads/master/Fuzi.podspec'
8182
8283
# Required if you use ReadiumAdapterGCDWebServer.
8384
pod 'ReadiumGCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/4.0.0/GCDWebServer.podspec'

Sources/Navigator/EditingAction.swift

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ final class EditingActionsController {
120120
}
121121

122122
func canPerformAction(_ selector: Selector) -> Bool {
123+
// Accessibility editing actions (e.g. Spoken Option in Accessibility
124+
// system settings) cannot be properly disabled.
125+
guard !selector.description.hasPrefix("_accessibility") else {
126+
return true
127+
}
128+
123129
guard
124130
isEnabled,
125131
let selection = selection,

TestApp/Integrations/CocoaPods/Podfile

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ target 'TestApp' do
1010
pod 'ReadiumAdapterGCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/VERSION/Support/CocoaPods/ReadiumAdapterGCDWebServer.podspec'
1111
pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/VERSION/Support/CocoaPods/ReadiumOPDS.podspec'
1212
pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/VERSION/Support/CocoaPods/ReadiumInternal.podspec'
13+
pod 'Fuzi', podspec: 'https://raw.githubusercontent.com/readium/Fuzi/refs/heads/master/Fuzi.podspec'
1314

1415
# Required for R2Streamer and ReadiumAdapterGCDWebServer.
1516
pod 'ReadiumGCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/master/GCDWebServer.podspec'

TestApp/Integrations/CocoaPods/Podfile+lcp

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ target 'TestApp' do
1212
pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/VERSION/Support/CocoaPods/ReadiumOPDS.podspec'
1313
pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/VERSION/Support/CocoaPods/ReadiumLCP.podspec'
1414
pod 'ReadiumInternal', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/VERSION/Support/CocoaPods/ReadiumInternal.podspec'
15+
pod 'Fuzi', podspec: 'https://raw.githubusercontent.com/readium/Fuzi/refs/heads/master/Fuzi.podspec'
1516
pod 'R2LCPClient', podspec: 'LCP_URL'
1617

1718
# Required for ReadiumStreamer and ReadiumAdapterGCDWebServer.

Tests/LCPTests/Content Protection/LCPDecryptorTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ class LCPDecryptorTests: XCTestCase {
7676
completionExpectation.fulfill()
7777
}
7878

79-
waitForExpectations(timeout: 10, handler: nil)
79+
waitForExpectations(timeout: 30, handler: nil)
8080
}
8181
}
File renamed without changes.
Loading

docs/Guides/Navigator/EPUB Fonts.md

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Font families in the EPUB navigator
2+
3+
Readium allows users to customize the font family used to render a reflowable EPUB, by changing the [EPUB navigator preferences](Navigator%20Preferences.md).
4+
5+
:warning: You cannot change the default font family of a fixed-layout EPUB (with zoomable pages), as it is similar to a PDF or a comic book.
6+
7+
## Available font families
8+
9+
iOS ships with a large collection of font families that you can use directly in the EPUB preferences. [Take a look at the Apple catalog of System Fonts](https://developer.apple.com/fonts/system-fonts/).
10+
11+
To improve readability, Readium embeds three additional font families designed for accessibility:
12+
13+
* [OpenDyslexic](https://opendyslexic.org/)
14+
* [AccessibleDfA](https://github.com/Orange-OpenSource/font-accessible-dfa), by Orange
15+
* [iA Writer Duospace](https://github.com/iaolo/iA-Fonts/tree/master/iA%20Writer%20Duospace), by iA
16+
17+
You can use all the iOS System Fonts out of the box with the EPUB navigator:
18+
19+
```swift
20+
epubNavigator.submitPreferences(EPUBPreferences(
21+
fontFamily: "Palatino"
22+
))
23+
```
24+
25+
Alternatively, extend `FontFamily` to benefit from the compiler type safety:
26+
27+
```swift
28+
extension FontFamily {
29+
public static let palatino: FontFamily = "Palatino"
30+
}
31+
32+
epubNavigator.submitPreferences(EPUBPreferences(
33+
fontFamily: .palatino
34+
))
35+
```
36+
37+
For your convenience, a number of [recommended fonts](https://readium.org/readium-css/docs/CSS09-default_fonts) are pre-declared in the `FontFamily` type: Iowan Old Style, Palatino, Athelas, Georgia, Helvetica Neue, Seravek and Arial.
38+
39+
## Setting the available font families in the user interface
40+
41+
If you build your settings user interface with the EPUB Preferences Editor, you can customize the list of available font families using `with(supportedValues:)`.
42+
43+
```swift
44+
epubPreferencesEditor.fontFamily.with(supportedValues: [
45+
nil, // A `nil` value means that the original author font will be used.
46+
.palatino,
47+
.helveticaNeue,
48+
.iaWriterDuospace,
49+
.accessibleDfA,
50+
.openDyslexic
51+
])
52+
```
53+
54+
## How to add custom font families?
55+
56+
To offer more choices to your users, you must embed and declare custom font families. Use the following steps:
57+
58+
1. Get the font files in the desired format, such as .ttf and .otf. [Google Fonts](https://fonts.google.com/) is a good source of free fonts.
59+
2. Add the files to your app target from Xcode.
60+
3. Declare new extensions for your custom font families to make them first-class citizens. This is optional but convenient.
61+
```swift
62+
extension FontFamily {
63+
public static let literata: FontFamily = "Literata"
64+
public static let atkinsonHyperlegible: FontFamily = "Atkinson Hyperlegible"
65+
}
66+
```
67+
4. Configure the EPUB navigator with a declaration of the font faces for all the additional font families.
68+
```swift
69+
let resources = Bundle.main.resourceURL!
70+
let navigator = try EPUBNavigatorViewController(
71+
publication: publication,
72+
initialLocation: locator,
73+
config: .init(
74+
fontFamilyDeclarations: [
75+
CSSFontFamilyDeclaration(
76+
fontFamily: .literata,
77+
fontFaces: [
78+
// Literata is a variable font family, so we can provide a font weight range.
79+
// https://fonts.google.com/knowledge/glossary/variable_fonts
80+
CSSFontFace(
81+
file: resources.appendingPathComponent("Literata-VariableFont_opsz,wght.ttf"),
82+
style: .normal, weight: .variable(200...900)
83+
),
84+
CSSFontFace(
85+
file: resources.appendingPathComponent("Literata-Italic-VariableFont_opsz,wght.ttf"),
86+
style: .italic, weight: .variable(200...900)
87+
)
88+
]
89+
).eraseToAnyHTMLFontFamilyDeclaration(),
90+
91+
CSSFontFamilyDeclaration(
92+
fontFamily: .atkinsonHyperlegible,
93+
fontFaces: [
94+
CSSFontFace(
95+
file: resources.appendingPathComponent("Atkinson-Hyperlegible-Regular.ttf"),
96+
style: .normal, weight: .standard(.normal)
97+
),
98+
CSSFontFace(
99+
file: resources.appendingPathComponent("Atkinson-Hyperlegible-Italic.ttf"),
100+
style: .italic, weight: .standard(.normal)
101+
),
102+
CSSFontFace(
103+
file: resources.appendingPathComponent("Atkinson-Hyperlegible-Bold.ttf"),
104+
style: .normal, weight: .standard(.bold)
105+
),
106+
CSSFontFace(
107+
file: resources.appendingPathComponent("Atkinson-Hyperlegible-BoldItalic.ttf"),
108+
style: .italic, weight: .standard(.bold)
109+
),
110+
]
111+
).eraseToAnyHTMLFontFamilyDeclaration()
112+
]
113+
),
114+
httpServer: GCDHTTPServer.shared
115+
)
116+
```
117+
118+
You are now ready to use your custom font families.
119+

0 commit comments

Comments
 (0)