Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Add new accessible fonts from Readium CSS #321

Merged
merged 3 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class UserSettings(var preferences: SharedPreferences, val context: Context, pri
lateinit var resourcePager: R2ViewPager

private val appearanceValues = listOf("readium-default-on", "readium-sepia-on", "readium-night-on")
private val fontFamilyValues = listOf("Original", "PT Serif", "Roboto", "Source Sans Pro", "Vollkorn", "OpenDyslexic")
private val fontFamilyValues = listOf("Original", "PT Serif", "Roboto", "Source Sans Pro", "Vollkorn", "OpenDyslexic", "AccessibleDfA", "IA Writer Duospace")
private val textAlignmentValues = listOf("justify", "start")
private val columnCountValues = listOf("auto", "1", "2")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ open class LibraryActivity : AppCompatActivity(), BooksAdapter.RecyclerViewClick

preferences = getSharedPreferences("org.readium.r2.settings", Context.MODE_PRIVATE)

val s = ServerSocket(0)
val s = ServerSocket(if (DEBUG) 8080 else 0)
s.localPort
s.close()

localPort = s.localPort
server = Server(localPort)
server = Server(localPort, applicationContext)

val properties = Properties()
val inputStream = this.assets.open("configs/config.properties")
Expand Down Expand Up @@ -643,12 +643,6 @@ open class LibraryActivity : AppCompatActivity(), BooksAdapter.RecyclerViewClick
if (DEBUG) Timber.e(e)
}
if (server.isAlive) {

// Add Resources from R2Navigator
server.loadReadiumCSSResources(assets)
server.loadR2ScriptResources(assets)
server.loadR2FontResources(assets, applicationContext)

// // Add your own resources here
// server.loadCustomResource(assets.open("scripts/test.js"), "test.js")
// server.loadCustomResource(assets.open("styles/test.css"), "test.css")
Expand All @@ -657,8 +651,6 @@ open class LibraryActivity : AppCompatActivity(), BooksAdapter.RecyclerViewClick
server.loadCustomResource(assets.open("Search/mark.js"), "mark.js", Injectable.Script)
server.loadCustomResource(assets.open("Search/search.js"), "search.js", Injectable.Script)
server.loadCustomResource(assets.open("Search/mark.css"), "mark.css", Injectable.Style)
server.loadCustomResource(assets.open("scripts/crypto-sha256.js"), "crypto-sha256.js", Injectable.Script)
server.loadCustomResource(assets.open("scripts/highlight.js"), "highlight.js", Injectable.Script)

isServerStarted = true
}
Expand Down
2 changes: 2 additions & 0 deletions r2-testapp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
<item>Source Sans Pro</item>
<item>Vollkorn</item>
<item>OpenDyslexic</item>
<item>AccessibleDfA</item>
<item>IA Writer Duospace</item>
</string-array>

</resources>