diff --git a/r2-navigator-swift/EPUB/EPUBNavigatorViewController.swift b/r2-navigator-swift/EPUB/EPUBNavigatorViewController.swift index 316bcf25..2b2f15d9 100644 --- a/r2-navigator-swift/EPUB/EPUBNavigatorViewController.swift +++ b/r2-navigator-swift/EPUB/EPUBNavigatorViewController.swift @@ -82,7 +82,7 @@ open class EPUBNavigatorViewController: UIViewController, VisualNavigator, Logga } /// Base URL on the resources server to the files in Static/ - /// Used to serve the ReadiumCSS files. + /// Used to serve Readium CSS. private let resourcesURL: URL? public init(publication: Publication, license: DRMLicense? = nil, initialLocation: Locator? = nil, resourcesServer: ResourcesServer, config: Configuration = .init()) { diff --git a/r2-navigator-swift/EPUB/EPUBReflowableSpreadView.swift b/r2-navigator-swift/EPUB/EPUBReflowableSpreadView.swift index c146fb3c..780e7ed2 100644 --- a/r2-navigator-swift/EPUB/EPUBReflowableSpreadView.swift +++ b/r2-navigator-swift/EPUB/EPUBReflowableSpreadView.swift @@ -302,18 +302,18 @@ final class EPUBReflowableSpreadView: EPUBSpreadView { scripts.append(WKUserScript(source: EPUBReflowableSpreadView.reflowableScript, injectionTime: .atDocumentStart, forMainFrameOnly: true)) - // Injects ReadiumCSS stylesheets. + // Injects Readium CSS's stylesheets. if let resourcesURL = resourcesURL { // When a publication is served from an HTTPS server, then WKWebView forbids accessing the stylesheets from the local, unsecured GCDWebServer instance. In this case we will inject directly the full content of the CSS in the JavaScript. if publication.baseURL?.scheme?.lowercased() == "https" { func loadCSS(_ name: String) -> String { - return loadResource(at: "styles/\(contentLayout.rawValue)/\(name).css") + return loadResource(at: contentLayout.readiumCSSPath(for: name)) .replacingOccurrences(of: "\\", with: "\\\\") .replacingOccurrences(of: "`", with: "\\`") } - let beforeCSS = loadCSS("ReadiumCSS-before") - let afterCSS = loadCSS("ReadiumCSS-after") + let beforeCSS = loadCSS("before") + let afterCSS = loadCSS("after") scripts.append(WKUserScript( source: EPUBReflowableSpreadView.cssInlineScript .replacingOccurrences(of: "${css-before}", with: beforeCSS) @@ -325,8 +325,7 @@ final class EPUBReflowableSpreadView: EPUBSpreadView { } else { scripts.append(WKUserScript( source: EPUBReflowableSpreadView.cssScript - .replacingOccurrences(of: "${resourcesURL}", with: resourcesURL.absoluteString) - .replacingOccurrences(of: "${contentLayout}", with: contentLayout.rawValue), + .replacingOccurrences(of: "${readiumCSSBaseURL}", with: resourcesURL.appendingPathComponent(contentLayout.readiumCSSBasePath).absoluteString), injectionTime: .atDocumentStart, forMainFrameOnly: false )) @@ -349,3 +348,27 @@ final class EPUBReflowableSpreadView: EPUBSpreadView { } } + +private extension ContentLayout { + + var readiumCSSBasePath: String { + let folder: String = { + switch self { + case .ltr: + return "" + case .rtl: + return "rtl/" + case .cjkVertical: + return "cjk-vertical/" + case .cjkHorizontal: + return "cjk-horizontal/" + } + }() + return "readium-css/\(folder)" + } + + func readiumCSSPath(for name: String) -> String { + return "\(readiumCSSBasePath)ReadiumCSS-\(name).css" + } + +} diff --git a/r2-navigator-swift/EPUB/Resources/Scripts/css.js b/r2-navigator-swift/EPUB/Resources/Scripts/css.js index 61eb6d50..791c5216 100644 --- a/r2-navigator-swift/EPUB/Resources/Scripts/css.js +++ b/r2-navigator-swift/EPUB/Resources/Scripts/css.js @@ -7,7 +7,7 @@ var link = document.createElement('link'); link.setAttribute('rel', 'stylesheet'); link.setAttribute('type', 'text/css'); - link.setAttribute('href', '${resourcesURL}/styles/${contentLayout}/' + name + '.css'); + link.setAttribute('href', '${readiumCSSBaseURL}' + name + '.css'); return link; } diff --git a/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadMe.md b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadMe.md new file mode 100644 index 00000000..b9d6ef6e --- /dev/null +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadMe.md @@ -0,0 +1,112 @@ +# Dealing with Languages/scripts + +You’ll find default stylesheets at the root of this folder, and languages/script-specific ones in their dedicated folder. + +This is a temporary solution to a complex issue (i18n), which is aligned with our current implementation so that we can start testing those specific styles as soon as possible. + +## Right to Left + +If the publication has: + +- a `page-progression-direction` with the value set to `rtl`; +- and language is either Arabic (`ar`), Farsi (`fa`) or Hebrew (`he`). + +Then stylesheets in the `rtl` folder should be used. + +It is also important the `dir` attribute and `xml:lang` be appended to the `html` element of each document if needed. + +Finally, page progression is impacted: + +- previous page is `right`; +- next page is `left`. + +### User settings + +Disabled user settings: + +- `hyphens`; +- `word-spacing`; +- `letter-spacing`. + +Added user settings: + +- `font-variant-ligatures` (mapped to `--USER__ligatures` CSS variable). + +## CJK + +Chinese, Japanese, Korean, and Mongolian can be either written `horizontal-tb` or `vertical-*`. Consequently, there are stylesheets for horizontal and vertical writing modes. + +### Horizontal + +If the publication has: + +- a `page-progression-direction` with the value set to `ltr` – or no attribute –; +- and (at least one) language item is either Chinese (`zh`), Japanese (`ja`), or Korean (`ko`). + +Then stylesheets in the `cjk/horizontal` subfolder should be used. + +It is also important the `xml:lang` be appended to the `html` element of each document if needed. + +#### User settings + +Disabled user settings: + +- `text-align`; +- `hyphens`; +- paragraphs’ indent; +- `word-spacing`; +- `letter-spacing`. + +### Vertical + +If the publication has: + +- a `page-progression-direction` with the value set to `rtl`; +- and (at least one) language item is either Chinese (`zh`), Japanese (`ja`), or Korean (`ko`). + +Then stylesheets in the `cjk/vertical` subfolder should be used. + +It is also important the `xml:lang` be appended to the `html` element of each document if needed. You MUST NOT append a `dir` attribute. + +Please note the `vertical-rl` writing mode will be enforced in this case. + +Finally, page progression is impacted: + +- previous page (`right`) goes up; +- next page (`left`) goes down. + +This means that taps/swipes should behave as usual in horizontal writing i.e. `x-axis` but the app programmatically handles the progression on the `y-axis`. You might therefore want to disable page-transition animations in this case. + +This is consistent with the Readium 1 implementation so the same logic can apply. + +#### User settings + +Disabled user settings: + +- `column-count` (number of columns); +- `text-align`; +- `hyphens`; +- paragraphs’ indent; +- `word-spacing`; +- `letter-spacing`. + +### EBPAJ Polyfill + +The EBPAJ template only references fonts from MS Windows so we must reference fonts from other platforms and override authors’ stylesheets. What we do in this polyfill is keeping their default value and providing fallbacks. + +You might want to load this polyfill (at the end, after `ReadiumCSS-after-cjk(-*)?.css`) only if you find one of the following metadata items in the OPF package: + +- version 1: `ebpaj-guide-1.0` +- version 1.1: `1.1` + +Since we must use `@font-face` to align with their specific implementation (we have to go through 9–11 `local` sources in the worst-case scenario), expect a “rendering debt” though. Do not hesitate to report performance issues for this polyfill. + +### Mongolian + +This is currently an edge case as we still have to see whether we want to support it and how we can support it. Indeed, the situation is the following: + +- Traditional is written `vertical-lr` so we can’t use `page-progression-direction` as an hint, and we must check if the language item (`mn`) is enough: + - if `mn-Mong` is set, then `vertical-lr` must be used; + - if `mn-Cyrl` is set, then the publication is in cyrillic and it is `horizontal-tb`. +- We don’t currently support the `mn` language, and we can’t rely on system fonts to do so, we’ll have to embed one. + diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-after.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-after.css similarity index 91% rename from r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-after.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-after.css index bca0ebdb..7950ef54 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-after.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-after.css @@ -39,7 +39,22 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Pagination module A set of styles to paginate ePublications @@ -48,9 +63,9 @@ /* Config */ -/* Columns are responsive by default, even if column-width is set in pixels, +/* Columns are responsive by default, even if column-width is set in pixels, which means two-page spread will switch to single page depending on current font-size. - If you want more control, I’m afraid you’ll have to update colWidth/colGap dynamically, + If you want more control, I’m afraid you’ll have to update colWidth/colGap dynamically, which is how a significant amount of RS do at the moment. */ /* Default for smartphone portrait (small screens) */ @@ -79,7 +94,7 @@ } /* :root selector has same specificity as a class i.e. 0010 - We might have to change that to html / context + We might have to change that to html / context -> https://css-tricks.com/almanac/selectors/r/root/ */ :root { @@ -187,7 +202,7 @@ body { } } -/* Readium CSS +/* Readium CSS Scroll module A set of styles to scroll ePublications @@ -196,7 +211,7 @@ body { Repo: https://github.com/readium/readium-css */ :root[style*="readium-scroll-on"] { - + /* Reset columns, auto + auto = columns can’t be created */ -webkit-columns: auto auto !important; -moz-columns: auto auto !important; @@ -207,57 +222,16 @@ body { max-height: none !important; /* Reset html size so that the user can scroll */ min-width: 0 !important; - min-height: 0 !important; + min-height: 0 !important; } /* Make sure line-length is limited in all configs */ :root[style*="readium-scroll-on"] body { - --RS__maxLineLength: 40rem !important; - - margin-top: var(--RS__pageGutter) !important; - margin-bottom: var(--RS__pageGutter) !important; -} - -/* Scroll mode horizontal */ - -/* Vertical writing needs body height set */ - -/* Do we add a top/bottom margin for body in vertical scroll or not? */ - -/* Readium CSS - Default highlights - - A stylesheet for user highlights - - Repo: https://github.com/readium/readium-css */ - -/* User Highlights */ - -.readiumCSS-yellow-highlight { - background-color: rgba(255, 255, 0, 0.5); -} - -.readiumCSS-green-highlight { - background-color: rgba(0, 255, 0, 0.5); -} - -.readiumCSS-orange-highlight { - background-color: rgba(255, 165, 0, 0.5); -} - -.readiumCSS-pink-highlight { - background-color: rgba(255, 105, 180, 0.5); + --RS__maxLineLength: 40rem !important; } -/* Media overlays */ - -.readiumCSS-mo-active-default { - color: black !important; - background-color: yellow !important; -} - -/* Readium CSS +/* Readium CSS Night mode A preset theme for night mode @@ -303,8 +277,11 @@ body { color: var(--RS__visitedColor) !important; } +/* For epub:type, in case the contents are served as text/html, namespaces won’t work hence why we’re using both syntax */ + :root[style*="readium-night-on"] img[class*="gaiji"], -:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { +:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, +:root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: invert(100%); filter: invert(100%); } @@ -330,7 +307,7 @@ body { filter: brightness(80%) invert(100%); } -/* Readium CSS +/* Readium CSS Sepia mode A preset theme for sepia mode @@ -355,11 +332,9 @@ body { /* we don’t need to redeclare bg-color and color for :root since we will inherit and update from day/default mode */ -:root[style*="readium-sepia-on"] body { - /* Should be transparent but Chrome bug https://bugs.chromium.org/p/chromium/issues/detail?id=711955&q=mix-blend-mode&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified */ - - color: inherit; - background-color: var(--RS__backgroundColor); +:root[style*="readium-sepia-on"] *:not(a) { + color: inherit !important; + background-color: transparent !important; } :root[style*="readium-sepia-on"] a:link, @@ -379,7 +354,7 @@ body { mix-blend-mode: multiply; } -/* Readium CSS +/* Readium CSS OS Accessibility Modes A stylesheet to deal with OS accessibility settings @@ -415,7 +390,8 @@ body { @media screen and (-ms-high-contrast: white-on-black) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -433,7 +409,8 @@ body { @media screen and (inverted-colors) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -456,7 +433,7 @@ body { /* If reduced motion is set on MacOS, in case we have animation/transition */ } -/* Readium CSS +/* Readium CSS Columns number pref A submodule managing columns number for user settings @@ -494,7 +471,7 @@ body { } } -/* Readium CSS +/* Readium CSS Page margins pref A submodule managing page margins for user settings @@ -508,7 +485,7 @@ body { padding: 0 calc(var(--RS__pageGutter) * var(--USER__pageMargins)) !important; } -/* Readium CSS +/* Readium CSS Custom colors pref A submodule managing custom colors for user settings @@ -532,7 +509,7 @@ body { color: inherit !important; } -/* Readium CSS +/* Readium CSS Text align pref A submodule managing text-align for user settings @@ -555,7 +532,7 @@ body { /* In case something goes wrong at the programmatic level + rtl for body + rtl in ltr */ -:root[style*="readium-advanced-on"][dir="rtl"][style*="--USER__textAlign:left"], +:root[style*="readium-advanced-on"][dir="rtl"][style*="--USER__textAlign: left"], :root[style*="readium-advanced-on"][dir="rtl"][style*="--USER__textAlign:left"], :root[style*="readium-advanced-on"][style*="--USER__textAlign: left"] *[dir="rtl"], :root[style*="readium-advanced-on"][style*="--USER__textAlign:left"] *[dir="rtl"] { @@ -564,12 +541,12 @@ body { /* Edge, if logical value is used, think of it as a polyfill. For LTR, it will fall back to the default, which is left */ -:root[style*="readium-advanced-on"][dir="rtl"][style*="--USER__textAlign:start"], +:root[style*="readium-advanced-on"][dir="rtl"][style*="--USER__textAlign: start"], :root[style*="readium-advanced-on"][dir="rtl"][style*="--USER__textAlign:start"] { text-align: right; } -/* Readium CSS +/* Readium CSS Hyphenation pref A submodule managing hyphens for user settings @@ -623,7 +600,7 @@ body { hyphens: inherit; } -/* Readium CSS +/* Readium CSS Font Family pref A submodule managing font-family for user settings @@ -659,7 +636,7 @@ body { font-family: inherit !important; } -/* Readium CSS +/* Readium CSS A11y font pref A submodule managing a11y text normalization for user settings @@ -667,11 +644,11 @@ body { Repo: https://github.com/readium/readium-css */ -/* For AccessibleDfa, we need to normalize font-weight and font-style since only the normal style is available */ +/* For AccessibleDfA, we need to normalize font-weight and font-style since only the normal style is available */ -:root[style*="readium-font-on"][style*="AccessibleDfa"] { +:root[style*="readium-font-on"][style*="AccessibleDfA"] { /* We won’t use the variable there since we need fallbacks for missing characters */ - font-family: AccessibleDfa, Verdana, Tahoma, "Trebuchet MS", sans-serif !important; + font-family: AccessibleDfA, Verdana, Tahoma, "Trebuchet MS", sans-serif !important; --RS__lineHeightCompensation: 1.167; } @@ -688,7 +665,7 @@ body { /* Maybe users want a setting to normalize any font offered so there is a “a11y Normalize” flag for it */ -:root[style*="readium-font-on"][style*="AccessibleDfa"], +:root[style*="readium-font-on"][style*="AccessibleDfA"], :root[style*="readium-font-on"][style*="IA Writer Duospace"], :root[style*="readium-font-on"][style*="readium-a11y-on"] { font-style: normal !important; @@ -697,7 +674,7 @@ body { /* Targeting everything except code. Note that Open Dyslexic has a monospaced font for code */ -:root[style*="readium-font-on"][style*="AccessibleDfa"] *:not(code):not(var):not(kbd):not(samp), +:root[style*="readium-font-on"][style*="AccessibleDfA"] *:not(code):not(var):not(kbd):not(samp), :root[style*="readium-font-on"][style*="IA Writer Duospace"] *:not(code):not(var):not(kbd):not(samp), :root[style*="readium-font-on"][style*="readium-a11y-on"] *:not(code):not(var):not(kbd):not(samp) { font-family: inherit !important; @@ -707,7 +684,7 @@ body { /* Normalizing text-decoration, subs and sups */ -:root[style*="readium-font-on"][style*="AccessibleDfa"] *, +:root[style*="readium-font-on"][style*="AccessibleDfA"] *, :root[style*="readium-font-on"][style*="IA Writer Duospace"] *, :root[style*="readium-font-on"][style*="readium-a11y-on"] * { text-decoration: none !important; @@ -716,17 +693,17 @@ body { font-variant-position: normal !important; } -:root[style*="readium-font-on"][style*="AccessibleDfa"] sup, +:root[style*="readium-font-on"][style*="AccessibleDfA"] sup, :root[style*="readium-font-on"][style*="IA Writer Duospace"] sup, :root[style*="readium-font-on"][style*="readium-a11y-on"] sup, -:root[style*="readium-font-on"][style*="AccessibleDfa"] sub, +:root[style*="readium-font-on"][style*="AccessibleDfA"] sub, :root[style*="readium-font-on"][style*="IA Writer Duospace"] sub, :root[style*="readium-font-on"][style*="readium-a11y-on"] sub { font-size: 1rem !important; vertical-align: baseline !important; } -/* Readium CSS +/* Readium CSS Font size pref A submodule managing font-size for user settings @@ -738,7 +715,7 @@ body { font-size: var(--USER__fontSize) !important; } -/* Readium CSS +/* Readium CSS Line height pref A submodule managing line-height for user settings @@ -757,7 +734,7 @@ body { line-height: inherit; } -/* Readium CSS +/* Readium CSS Para spacing pref A submodule managing paragraphs’ top and bottom margins for user settings @@ -770,7 +747,7 @@ body { margin-bottom: var(--USER__paraSpacing) !important; } -/* Readium CSS +/* Readium CSS Para indent pref A submodule managing paragraphs’ text-indent for user settings @@ -789,7 +766,7 @@ body { text-indent: 0 !important; } -/* Readium CSS +/* Readium CSS Word spacing pref A submodule managing word-spacing for user settings @@ -809,7 +786,7 @@ body { word-spacing: var(--USER__wordSpacing); } -/* Readium CSS +/* Readium CSS Letter spacing pref A submodule managing letter-spacing for user settings @@ -830,7 +807,7 @@ body { font-variant: none; } -/* Readium CSS +/* Readium CSS Font size normalize A stylesheet to normalize font-size @@ -889,7 +866,7 @@ body { font-size: 67.5% !important; } -/* The following styles kick in if you define the typeScale variable in the DOM. +/* The following styles kick in if you define the typeScale variable in the DOM. No need to repeat declarations which don’t make use of the variable */ :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h1 { @@ -903,3 +880,44 @@ body { :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h3 { font-size: calc(1rem * var(--USER__typeScale)) !important; } + +/* Readium CSS + Default highlights + + A stylesheet for user highlights + + Repo: https://github.com/readium/readium-css */ + +/* User Highlights */ + +.readiumCSS-yellow-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-yellow-highlight, +:root[style*="readium-night-on"] .readiumCSS-yellow-highlight { + background-color: rgba(255, 255, 0, 0.5) !important; +} + +.readiumCSS-green-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-green-highlight, +:root[style*="readium-night-on"] .readiumCSS-green-highlight { + background-color: rgba(0, 255, 0, 0.5) !important; +} + +.readiumCSS-orange-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-orange-highlight, +:root[style*="readium-night-on"] .readiumCSS-orange-highlight { + background-color: rgba(255, 165, 0, 0.5) !important; +} + +.readiumCSS-pink-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-pink-highlight, +:root[style*="readium-night-on"] .readiumCSS-pink-highlight { + background-color: rgba(255, 105, 180, 0.5) !important; +} + +/* Media overlays */ + +.readiumCSS-mo-active-default { + color: black !important; + background-color: yellow !important; +} +/*# sourceMappingURL=ReadiumCSS-after.css.map */ \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-before.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-before.css similarity index 94% rename from r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-before.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-before.css index 2c5a0fbb..6511e6d5 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-before.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-before.css @@ -39,10 +39,10 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS - Base module +/* Readium CSS + Namespaces module - A minimal stylesheet for all ebooks + Namespaces to import in all 3 dist stylesheets Repo: https://github.com/readium/readium-css */ @@ -54,6 +54,13 @@ @namespace svg url("http://www.w3.org/2000/svg"); +/* Readium CSS + Base module + + A minimal stylesheet for all ebooks + + Repo: https://github.com/readium/readium-css */ + /* Define viewport, HTML5-style */ @-ms-viewport { @@ -75,7 +82,7 @@ /* Config */ --RS__baseFontFamily: var(--RS__oldStyleTf); - + /* For square-ish fonts (CJK, Indic, etc.), we must apply some compensation in dynamic leading. Default is 1 i.e. no compensation */ --RS__lineHeightCompensation: 1; @@ -170,7 +177,7 @@ math { :lang(ja) { --RS__baseFontFamily: "游ゴシック体", YuGothic, "ヒラギノ丸ゴ", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", "MS Gothic", Roboto, Noto, "Noto Sans CJK JP", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; @@ -193,7 +200,7 @@ math { :lang(ko) { --RS__baseFontFamily: "Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", Roboto, Noto, "Noto Sans CJK KR", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } @@ -248,19 +255,19 @@ math { :lang(zh-Hant), :lang(zh-TW) { --RS__baseFontFamily: "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } :lang(zh-HK) { --RS__baseFontFamily: "方體", "PingFang HK", "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } -/* Readium CSS +/* Readium CSS Day/Default mode A preset theme for day mode, which is the default @@ -295,7 +302,7 @@ math { background-color: var(--RS__selectionBackgroundColor); } -/* Readium CSS +/* Readium CSS Fonts module A stylesheet for embedded fonts @@ -305,10 +312,10 @@ math { /* /!\ Mind the path (relative to the folders in which you have stylesheets and the fonts) */ @font-face { - font-family: AccessibleDfa; + font-family: AccessibleDfA; font-style: normal; font-weight: normal; - src: local("AccessibleDfa"), + src: local("AccessibleDfA"), url("fonts/AccessibleDfA.otf") format("opentype"); } @@ -320,12 +327,12 @@ math { url("fonts/iAWriterDuospace-Regular.ttf") format("truetype"); } -/* If you have different weights/styles, - use `font-weight` and `font-style`, - not prefixes in the font-family name, +/* If you have different weights/styles, + use `font-weight` and `font-style`, + not prefixes in the font-family name, or else it will be a nightmare to manage in user settings. */ -/* Readium CSS +/* Readium CSS HTML5 SR Patch stylesheet A set of style to adjust HTML5 Suggested Rendering to paginated content @@ -344,15 +351,28 @@ figcaption, th, td { orphans: 1; } -h2, h3, h4, h5, h6, dt, -hr, caption { +h2, +h3, +h4, +h5, +h6, +dt, +hr, +caption { -webkit-column-break-after: avoid; page-break-after: avoid; break-after: avoid; } -h1, h2, h3, h4, h5, h6, dt, -figure, tr { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figure, +tr { -webkit-column-break-inside: avoid; page-break-inside: avoid; break-inside: avoid; @@ -370,9 +390,20 @@ body { hyphenate-limit-lines: 3; } -h1, h2, h3, h4, h5, h6, dt, -figcaption, pre, caption, address, -center, code, var { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figcaption, +pre, +caption, +address, +center, +code, +var { -ms-hyphens: none; -moz-hyphens: none; -webkit-hyphens: none; @@ -434,13 +465,13 @@ figure, blockquote { margin: 1em 5%; } -/* +/* :lang(ja) figure, :lang(ja) blockquote, :lang(zh-Hant) figure, :lang(zh-Hant) blockquote, :lang(zh-TW) figure, :lang(zh-TW) blockquote, :lang(mn) figure, :lang(mn) blockquote { - margin: 5% 1em; + margin: 5% 1em; } */ @@ -449,13 +480,13 @@ ul, ol { padding-left: 5%; } -/* +/* :lang(ja) ul, :lang(ja) ol, :lang(zh-Hant) ul, :lang(zh-Hant) ol, :lang(zh-TW) ul, :lang(zh-TW) ol, :lang(mn) ul, :lang(mn) ol { - padding-top: 5%; + padding-top: 5%; } */ @@ -464,13 +495,13 @@ dd { margin-left: 5%; } -/* +/* :lang(ja) dd, :lang(zh-Hant) dd, -:lang(zh-TW) dd, +:lang(zh-TW) dd, :lang(mn) dd { - margin-top: 5%; + margin-top: 5%; } */ @@ -507,19 +538,28 @@ ruby > rt, ruby > rp { *:lang(ja), *:lang(zh), *:lang(ko), -:lang(ja) cite, :lang(ja) dfn, :lang(ja) em, :lang(ja) i, -:lang(zh) cite, :lang(zh) dfn, :lang(zh) em, :lang(zh) i, -:lang(ko) cite, :lang(ko) dfn, :lang(ko) em, :lang(ko) i { +:lang(ja) cite, +:lang(ja) dfn, +:lang(ja) em, +:lang(ja) i, +:lang(zh) cite, +:lang(zh) dfn, +:lang(zh) em, +:lang(zh) i, +:lang(ko) cite, +:lang(ko) dfn, +:lang(ko) em, +:lang(ko) i { font-style: normal; } -:lang(ja) a, +:lang(ja) a, :lang(zh) a, :lang(ko) a { text-decoration: none; } -/* Readium CSS +/* Readium CSS Safeguards module A set of styles to prevent common issues in pagination @@ -534,7 +574,7 @@ ruby > rt, ruby > rp { /* max-width for media, you can override that via JS if not compiled to static */ --RS__maxMediaWidth: 100%; - /* max-height for media, you can override that via JS if not compiled to static + /* max-height for media, you can override that via JS if not compiled to static Please consider figures might have a figcaption, which is why 95vh in the first place */ --RS__maxMediaHeight: 95vh; @@ -597,9 +637,7 @@ img, svg, audio, video { /* Try preventing border being cut-off, webkit + blink have content-box by default */ table { - - /* We might want to set at least overflow-x to auto in case the table doesn't fit, - max-width is not necessarily the best solution there, but maybe we could investigate transform scale */ - overflow-x: auto; + max-width: var(--RS__maxMediaWidth); box-sizing: var(--RS__boxSizingTable); } +/*# sourceMappingURL=ReadiumCSS-before.css.map */ \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-default.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-default.css similarity index 83% rename from r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-default.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-default.css index 00b6269e..78aa0172 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/ltr/ReadiumCSS-default.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-default.css @@ -1,4 +1,19 @@ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Default module A stylesheet for unstyled ebooks based on HTML5 Suggested Rendering @@ -40,19 +55,30 @@ h1, h2, h3, h4, h5, h6 { /* Flow content */ -blockquote, figure, p, pre, -aside, footer, form, hr { +blockquote, +figure, +p, +pre, +aside, +footer, +form, +hr { margin-top: var(--RS__flowSpacing); margin-bottom: var(--RS__flowSpacing); } p { margin-top: var(--RS__paraSpacing); - margin-bottom: var(--RS__paraSpacing); + margin-bottom: var(--RS__paraSpacing); text-indent: var(--RS__paraIndent); } -h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p, +h1 + p, +h2 + p, +h3 + p, +h4 + p, +h5 + p, +h6 + p, hr + p { text-indent: 0; } @@ -160,3 +186,4 @@ th, td { padding: 4px; border: 1px solid currentColor; } +/*# sourceMappingURL=ReadiumCSS-default.css.map */ \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-ebpaj_fonts_patch.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-ebpaj_fonts_patch.css new file mode 100644 index 00000000..b73eb674 --- /dev/null +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/ReadiumCSS-ebpaj_fonts_patch.css @@ -0,0 +1,80 @@ +/* Readium CSS + EBPAJ Fonts Patch module + + A stylesheet improving EBPAJ @font-face declarations to cover all platforms + + Repo: https://github.com/readium/readium-css */ + +/* EBPAJ template only references fonts from MS Windows… + so we must reference fonts from other platforms + and override authors’ stylesheets. + What we do there is keeping their default value and providing fallbacks. + + /!\ /!\ /!\ /!\ /!\ + FYI, you might want to load this polyfill only if you find + one of the following metadata items in the OPF package: + - version 1: + ebpaj-guide-1.0 + - version 1.1: + 1.1 + */ + +/* 横組み用 (horizontal writing) */ + +@font-face { + font-family: "serif-ja"; + src: local("MS P明朝"), + local("MS PMincho"), + local("Hiragino Mincho Pro"), + local("ヒラギノ明朝 Pro W3"), + local("游明朝"), + local("YuMincho"), + local("MS 明朝"), + local("MS Mincho"), + local("Hiragino Mincho ProN"); +} + +@font-face { + font-family: "sans-serif-ja"; + src: local("MS Pゴシック"), + local("MS PGothic"), + local("Hiragino Kaku Gothic Pro W3"), + local("ヒラギノ角ゴ Pro W3"), + local("Hiragino Sans GB"), + local("ヒラギノ角ゴシック W3"), + local("游ゴシック"), + local("YuGothic"), + local("MS ゴシック"), + local("MS Gothic"), + local("Hiragino Sans"); +} + +/* 縦組み用 (vertical writing) */ + +@font-face { + font-family: "serif-ja-v"; + src: local("MS 明朝"), + local("MS Mincho"), + local("Hiragino Mincho Pro"), + local("ヒラギノ明朝 Pro W3"), + local("游明朝"), + local("YuMincho"), + local("MS P明朝"), + local("MS PMincho"), + local("Hiragino Mincho ProN"); +} + +@font-face { + font-family: "sans-serif-ja-v"; + src: local("MS ゴシック"), + local("MS Gothic"), + local("Hiragino Kaku Gothic Pro W3"), + local("ヒラギノ角ゴ Pro W3"), + local("Hiragino Sans GB"), + local("ヒラギノ角ゴシック W3"), + local("游ゴシック"), + local("YuGothic"), + local("MS Pゴシック"), + local("MS PGothic"), + local("Hiragino Sans"); +} \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-after.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-after.css similarity index 90% rename from r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-after.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-after.css index 020c57c7..47867bfd 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-after.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-after.css @@ -39,7 +39,22 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Pagination module A set of styles to paginate ePublications @@ -48,9 +63,9 @@ /* Config */ -/* Columns are responsive by default, even if column-width is set in pixels, +/* Columns are responsive by default, even if column-width is set in pixels, which means two-page spread will switch to single page depending on current font-size. - If you want more control, I’m afraid you’ll have to update colWidth/colGap dynamically, + If you want more control, I’m afraid you’ll have to update colWidth/colGap dynamically, which is how a significant amount of RS do at the moment. */ /* Default for smartphone portrait (small screens) */ @@ -79,7 +94,7 @@ } /* :root selector has same specificity as a class i.e. 0010 - We might have to change that to html / context + We might have to change that to html / context -> https://css-tricks.com/almanac/selectors/r/root/ */ :root { @@ -187,7 +202,7 @@ body { } } -/* Readium CSS +/* Readium CSS Scroll module A set of styles to scroll ePublications @@ -196,7 +211,7 @@ body { Repo: https://github.com/readium/readium-css */ :root[style*="readium-scroll-on"] { - + /* Reset columns, auto + auto = columns can’t be created */ -webkit-columns: auto auto !important; -moz-columns: auto auto !important; @@ -207,57 +222,16 @@ body { max-height: none !important; /* Reset html size so that the user can scroll */ min-width: 0 !important; - min-height: 0 !important; + min-height: 0 !important; } /* Make sure line-length is limited in all configs */ :root[style*="readium-scroll-on"] body { - --RS__maxLineLength: 40rem !important; - - margin-top: var(--RS__pageGutter) !important; - margin-bottom: var(--RS__pageGutter) !important; -} - -/* Scroll mode horizontal */ - -/* Vertical writing needs body height set */ - -/* Do we add a top/bottom margin for body in vertical scroll or not? */ - -/* Readium CSS - Default highlights - - A stylesheet for user highlights - - Repo: https://github.com/readium/readium-css */ - -/* User Highlights */ - -.readiumCSS-yellow-highlight { - background-color: rgba(255, 255, 0, 0.5); -} - -.readiumCSS-green-highlight { - background-color: rgba(0, 255, 0, 0.5); -} - -.readiumCSS-orange-highlight { - background-color: rgba(255, 165, 0, 0.5); -} - -.readiumCSS-pink-highlight { - background-color: rgba(255, 105, 180, 0.5); -} - -/* Media overlays */ - -.readiumCSS-mo-active-default { - color: black !important; - background-color: yellow !important; + --RS__maxLineLength: 40rem !important; } -/* Readium CSS +/* Readium CSS Night mode A preset theme for night mode @@ -303,8 +277,11 @@ body { color: var(--RS__visitedColor) !important; } +/* For epub:type, in case the contents are served as text/html, namespaces won’t work hence why we’re using both syntax */ + :root[style*="readium-night-on"] img[class*="gaiji"], -:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { +:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, +:root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: invert(100%); filter: invert(100%); } @@ -330,7 +307,7 @@ body { filter: brightness(80%) invert(100%); } -/* Readium CSS +/* Readium CSS Sepia mode A preset theme for sepia mode @@ -355,11 +332,9 @@ body { /* we don’t need to redeclare bg-color and color for :root since we will inherit and update from day/default mode */ -:root[style*="readium-sepia-on"] body { - /* Should be transparent but Chrome bug https://bugs.chromium.org/p/chromium/issues/detail?id=711955&q=mix-blend-mode&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified */ - - color: inherit; - background-color: var(--RS__backgroundColor); +:root[style*="readium-sepia-on"] *:not(a) { + color: inherit !important; + background-color: transparent !important; } :root[style*="readium-sepia-on"] a:link, @@ -379,7 +354,7 @@ body { mix-blend-mode: multiply; } -/* Readium CSS +/* Readium CSS OS Accessibility Modes A stylesheet to deal with OS accessibility settings @@ -415,7 +390,8 @@ body { @media screen and (-ms-high-contrast: white-on-black) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -433,7 +409,8 @@ body { @media screen and (inverted-colors) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -456,7 +433,7 @@ body { /* If reduced motion is set on MacOS, in case we have animation/transition */ } -/* Readium CSS +/* Readium CSS Columns number pref A submodule managing columns number for user settings @@ -494,7 +471,7 @@ body { } } -/* Readium CSS +/* Readium CSS Page margins pref A submodule managing page margins for user settings @@ -508,7 +485,7 @@ body { padding: 0 calc(var(--RS__pageGutter) * var(--USER__pageMargins)) !important; } -/* Readium CSS +/* Readium CSS Custom colors pref A submodule managing custom colors for user settings @@ -532,7 +509,7 @@ body { color: inherit !important; } -/* Readium CSS +/* Readium CSS Font Family pref A submodule managing font-family for user settings @@ -568,7 +545,7 @@ body { font-family: inherit !important; } -/* Readium CSS +/* Readium CSS Font size pref A submodule managing font-size for user settings @@ -580,7 +557,7 @@ body { font-size: var(--USER__fontSize) !important; } -/* Readium CSS +/* Readium CSS Line height pref A submodule managing line-height for user settings @@ -599,7 +576,7 @@ body { line-height: inherit; } -/* Readium CSS +/* Readium CSS Para spacing pref A submodule managing paragraphs’ top and bottom margins for user settings @@ -612,7 +589,7 @@ body { margin-bottom: var(--USER__paraSpacing) !important; } -/* Readium CSS +/* Readium CSS Font size normalize A stylesheet to normalize font-size @@ -671,7 +648,7 @@ body { font-size: 67.5% !important; } -/* The following styles kick in if you define the typeScale variable in the DOM. +/* The following styles kick in if you define the typeScale variable in the DOM. No need to repeat declarations which don’t make use of the variable */ :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h1 { @@ -685,4 +662,44 @@ body { :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h3 { font-size: calc(1rem * var(--USER__typeScale)) !important; } + +/* Readium CSS + Default highlights + + A stylesheet for user highlights + + Repo: https://github.com/readium/readium-css */ + +/* User Highlights */ + +.readiumCSS-yellow-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-yellow-highlight, +:root[style*="readium-night-on"] .readiumCSS-yellow-highlight { + background-color: rgba(255, 255, 0, 0.5) !important; +} + +.readiumCSS-green-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-green-highlight, +:root[style*="readium-night-on"] .readiumCSS-green-highlight { + background-color: rgba(0, 255, 0, 0.5) !important; +} + +.readiumCSS-orange-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-orange-highlight, +:root[style*="readium-night-on"] .readiumCSS-orange-highlight { + background-color: rgba(255, 165, 0, 0.5) !important; +} + +.readiumCSS-pink-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-pink-highlight, +:root[style*="readium-night-on"] .readiumCSS-pink-highlight { + background-color: rgba(255, 105, 180, 0.5) !important; +} + +/* Media overlays */ + +.readiumCSS-mo-active-default { + color: black !important; + background-color: yellow !important; +} /*# sourceMappingURL=ReadiumCSS-after.css.map */ \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-before.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-before.css similarity index 95% rename from r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-before.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-before.css index 28778589..dcb79fff 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-before.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-before.css @@ -39,10 +39,10 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS - Base module +/* Readium CSS + Namespaces module - A minimal stylesheet for all ebooks + Namespaces to import in all 3 dist stylesheets Repo: https://github.com/readium/readium-css */ @@ -54,6 +54,13 @@ @namespace svg url("http://www.w3.org/2000/svg"); +/* Readium CSS + Base module + + A minimal stylesheet for all ebooks + + Repo: https://github.com/readium/readium-css */ + /* Define viewport, HTML5-style */ @-ms-viewport { @@ -75,7 +82,7 @@ /* Config */ --RS__baseFontFamily: var(--RS__oldStyleTf); - + /* For square-ish fonts (CJK, Indic, etc.), we must apply some compensation in dynamic leading. Default is 1 i.e. no compensation */ --RS__lineHeightCompensation: 1; @@ -170,7 +177,7 @@ math { :lang(ja) { --RS__baseFontFamily: "游ゴシック体", YuGothic, "ヒラギノ丸ゴ", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", "MS Gothic", Roboto, Noto, "Noto Sans CJK JP", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; @@ -193,7 +200,7 @@ math { :lang(ko) { --RS__baseFontFamily: "Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", Roboto, Noto, "Noto Sans CJK KR", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } @@ -248,19 +255,19 @@ math { :lang(zh-Hant), :lang(zh-TW) { --RS__baseFontFamily: "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } :lang(zh-HK) { --RS__baseFontFamily: "方體", "PingFang HK", "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } -/* Readium CSS +/* Readium CSS Day/Default mode A preset theme for day mode, which is the default @@ -297,7 +304,7 @@ math { /* @import "modules/ReadiumCSS-fonts.css"; */ -/* Readium CSS +/* Readium CSS HTML5 SR Patch stylesheet A set of style to adjust HTML5 Suggested Rendering to paginated content @@ -316,15 +323,28 @@ figcaption, th, td { orphans: 1; } -h2, h3, h4, h5, h6, dt, -hr, caption { +h2, +h3, +h4, +h5, +h6, +dt, +hr, +caption { -webkit-column-break-after: avoid; page-break-after: avoid; break-after: avoid; } -h1, h2, h3, h4, h5, h6, dt, -figure, tr { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figure, +tr { -webkit-column-break-inside: avoid; page-break-inside: avoid; break-inside: avoid; @@ -342,9 +362,20 @@ body { hyphenate-limit-lines: 3; } -h1, h2, h3, h4, h5, h6, dt, -figcaption, pre, caption, address, -center, code, var { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figcaption, +pre, +caption, +address, +center, +code, +var { -ms-hyphens: none; -moz-hyphens: none; -webkit-hyphens: none; @@ -406,13 +437,13 @@ figure, blockquote { margin: 1em 5%; } -/* +/* :lang(ja) figure, :lang(ja) blockquote, :lang(zh-Hant) figure, :lang(zh-Hant) blockquote, :lang(zh-TW) figure, :lang(zh-TW) blockquote, :lang(mn) figure, :lang(mn) blockquote { - margin: 5% 1em; + margin: 5% 1em; } */ @@ -421,13 +452,13 @@ ul, ol { padding-left: 5%; } -/* +/* :lang(ja) ul, :lang(ja) ol, :lang(zh-Hant) ul, :lang(zh-Hant) ol, :lang(zh-TW) ul, :lang(zh-TW) ol, :lang(mn) ul, :lang(mn) ol { - padding-top: 5%; + padding-top: 5%; } */ @@ -436,13 +467,13 @@ dd { margin-left: 5%; } -/* +/* :lang(ja) dd, :lang(zh-Hant) dd, -:lang(zh-TW) dd, +:lang(zh-TW) dd, :lang(mn) dd { - margin-top: 5%; + margin-top: 5%; } */ @@ -479,19 +510,28 @@ ruby > rt, ruby > rp { *:lang(ja), *:lang(zh), *:lang(ko), -:lang(ja) cite, :lang(ja) dfn, :lang(ja) em, :lang(ja) i, -:lang(zh) cite, :lang(zh) dfn, :lang(zh) em, :lang(zh) i, -:lang(ko) cite, :lang(ko) dfn, :lang(ko) em, :lang(ko) i { +:lang(ja) cite, +:lang(ja) dfn, +:lang(ja) em, +:lang(ja) i, +:lang(zh) cite, +:lang(zh) dfn, +:lang(zh) em, +:lang(zh) i, +:lang(ko) cite, +:lang(ko) dfn, +:lang(ko) em, +:lang(ko) i { font-style: normal; } -:lang(ja) a, +:lang(ja) a, :lang(zh) a, :lang(ko) a { text-decoration: none; } -/* Readium CSS +/* Readium CSS Safeguards module A set of styles to prevent common issues in pagination @@ -506,7 +546,7 @@ ruby > rt, ruby > rp { /* max-width for media, you can override that via JS if not compiled to static */ --RS__maxMediaWidth: 100%; - /* max-height for media, you can override that via JS if not compiled to static + /* max-height for media, you can override that via JS if not compiled to static Please consider figures might have a figcaption, which is why 95vh in the first place */ --RS__maxMediaHeight: 95vh; diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-default.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-default.css similarity index 87% rename from r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-default.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-default.css index d7877db9..37530d83 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-horizontal/ReadiumCSS-default.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-horizontal/ReadiumCSS-default.css @@ -1,4 +1,19 @@ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Default module for CJK horizontal writing A stylesheet for unstyled ebooks based on HTML5 Suggested Rendering @@ -32,6 +47,10 @@ --RS__secondaryColor: ; } +:root:lang(zh) { + --RS__paraIndent: 2em; +} + /* STYLES */ /* Typo */ @@ -54,23 +73,24 @@ h1, h2, h3, h4, h5, h6 { /* Flow content */ -blockquote, figure, p, pre, -aside, footer, form, hr { +blockquote, +figure, +p, +pre, +aside, +footer, +form, +hr { margin-top: var(--RS__flowSpacing); margin-bottom: var(--RS__flowSpacing); } p { margin-top: var(--RS__paraSpacing); - margin-bottom: var(--RS__paraSpacing); + margin-bottom: var(--RS__paraSpacing); text-indent: var(--RS__paraIndent); } -h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p, -hr + p { - text-indent: 0; -} - pre { font-family: var(--RS__codeFontFamily); } diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-after.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-after.css similarity index 90% rename from r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-after.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-after.css index cb34fa28..d60d264d 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-after.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-after.css @@ -39,7 +39,22 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Pagination module for vertical writing A set of styles to paginate ePublications in “writing-mode: vertical-*” @@ -76,7 +91,7 @@ } /* :root selector has same specificity as a class i.e. 0010 - We might have to change that to html / context + We might have to change that to html / context -> https://css-tricks.com/almanac/selectors/r/root/ */ :root { @@ -197,7 +212,7 @@ body { /* At this point (80em or so), constraining line length must be done at the web view/iframe level, or by limiting the size of :root itself */ -/* Readium CSS +/* Readium CSS Scroll module for vertical-writing A set of styles to scroll ePublications in “writing-mode: vertical-*” @@ -206,7 +221,7 @@ body { Repo: https://github.com/readium/readium-css */ :root[style*="readium-scroll-on"] { - + /* Reset columns, auto + auto = columns can’t be created */ /* There is a weird gap in Safari/Webkit, as if overflow paged-x… */ -webkit-columns: auto auto !important; @@ -229,39 +244,7 @@ body { /* Do we add a top/bottom margin for body in vertical scroll or not? */ -/* Readium CSS - Default highlights - - A stylesheet for user highlights - - Repo: https://github.com/readium/readium-css */ - -/* User Highlights */ - -.readiumCSS-yellow-highlight { - background-color: rgba(255, 255, 0, 0.5); -} - -.readiumCSS-green-highlight { - background-color: rgba(0, 255, 0, 0.5); -} - -.readiumCSS-orange-highlight { - background-color: rgba(255, 165, 0, 0.5); -} - -.readiumCSS-pink-highlight { - background-color: rgba(255, 105, 180, 0.5); -} - -/* Media overlays */ - -.readiumCSS-mo-active-default { - color: black !important; - background-color: yellow !important; -} - -/* Readium CSS +/* Readium CSS Night mode A preset theme for night mode @@ -307,8 +290,11 @@ body { color: var(--RS__visitedColor) !important; } +/* For epub:type, in case the contents are served as text/html, namespaces won’t work hence why we’re using both syntax */ + :root[style*="readium-night-on"] img[class*="gaiji"], -:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { +:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, +:root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: invert(100%); filter: invert(100%); } @@ -334,7 +320,7 @@ body { filter: brightness(80%) invert(100%); } -/* Readium CSS +/* Readium CSS Sepia mode A preset theme for sepia mode @@ -359,11 +345,9 @@ body { /* we don’t need to redeclare bg-color and color for :root since we will inherit and update from day/default mode */ -:root[style*="readium-sepia-on"] body { - /* Should be transparent but Chrome bug https://bugs.chromium.org/p/chromium/issues/detail?id=711955&q=mix-blend-mode&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified */ - - color: inherit; - background-color: var(--RS__backgroundColor); +:root[style*="readium-sepia-on"] *:not(a) { + color: inherit !important; + background-color: transparent !important; } :root[style*="readium-sepia-on"] a:link, @@ -383,7 +367,7 @@ body { mix-blend-mode: multiply; } -/* Readium CSS +/* Readium CSS OS Accessibility Modes A stylesheet to deal with OS accessibility settings @@ -419,7 +403,8 @@ body { @media screen and (-ms-high-contrast: white-on-black) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -437,7 +422,8 @@ body { @media screen and (inverted-colors) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -460,7 +446,7 @@ body { /* If reduced motion is set on MacOS, in case we have animation/transition */ } -/* Readium CSS +/* Readium CSS Page margins pref A submodule managing page margins for user settings @@ -474,7 +460,7 @@ body { padding: calc(var(--RS__pageGutter) * var(--USER__pageMargins)) 0 !important; } -/* Readium CSS +/* Readium CSS Custom colors pref A submodule managing custom colors for user settings @@ -498,7 +484,7 @@ body { color: inherit !important; } -/* Readium CSS +/* Readium CSS Font Family pref A submodule managing font-family for user settings @@ -534,7 +520,7 @@ body { font-family: inherit !important; } -/* Readium CSS +/* Readium CSS Font size pref A submodule managing font-size for user settings @@ -546,7 +532,7 @@ body { font-size: var(--USER__fontSize) !important; } -/* Readium CSS +/* Readium CSS Line height pref A submodule managing line-height for user settings @@ -565,7 +551,7 @@ body { line-height: inherit; } -/* Readium CSS +/* Readium CSS Para spacing pref A submodule managing paragraphs’ top and bottom margins for user settings @@ -578,7 +564,7 @@ body { margin-left: var(--USER__paraSpacing) !important; } -/* Readium CSS +/* Readium CSS Font size normalize A stylesheet to normalize font-size @@ -637,7 +623,7 @@ body { font-size: 67.5% !important; } -/* The following styles kick in if you define the typeScale variable in the DOM. +/* The following styles kick in if you define the typeScale variable in the DOM. No need to repeat declarations which don’t make use of the variable */ :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h1 { @@ -651,4 +637,44 @@ body { :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h3 { font-size: calc(1rem * var(--USER__typeScale)) !important; } + +/* Readium CSS + Default highlights + + A stylesheet for user highlights + + Repo: https://github.com/readium/readium-css */ + +/* User Highlights */ + +.readiumCSS-yellow-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-yellow-highlight, +:root[style*="readium-night-on"] .readiumCSS-yellow-highlight { + background-color: rgba(255, 255, 0, 0.5) !important; +} + +.readiumCSS-green-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-green-highlight, +:root[style*="readium-night-on"] .readiumCSS-green-highlight { + background-color: rgba(0, 255, 0, 0.5) !important; +} + +.readiumCSS-orange-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-orange-highlight, +:root[style*="readium-night-on"] .readiumCSS-orange-highlight { + background-color: rgba(255, 165, 0, 0.5) !important; +} + +.readiumCSS-pink-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-pink-highlight, +:root[style*="readium-night-on"] .readiumCSS-pink-highlight { + background-color: rgba(255, 105, 180, 0.5) !important; +} + +/* Media overlays */ + +.readiumCSS-mo-active-default { + color: black !important; + background-color: yellow !important; +} /*# sourceMappingURL=ReadiumCSS-after.css.map */ \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-before.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-before.css similarity index 95% rename from r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-before.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-before.css index 100b3202..2c8d03df 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-before.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-before.css @@ -39,10 +39,10 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS - Base module +/* Readium CSS + Namespaces module - A minimal stylesheet for all ebooks + Namespaces to import in all 3 dist stylesheets Repo: https://github.com/readium/readium-css */ @@ -54,6 +54,13 @@ @namespace svg url("http://www.w3.org/2000/svg"); +/* Readium CSS + Base module + + A minimal stylesheet for all ebooks + + Repo: https://github.com/readium/readium-css */ + /* Define viewport, HTML5-style */ @-ms-viewport { @@ -75,7 +82,7 @@ /* Config */ --RS__baseFontFamily: var(--RS__oldStyleTf); - + /* For square-ish fonts (CJK, Indic, etc.), we must apply some compensation in dynamic leading. Default is 1 i.e. no compensation */ --RS__lineHeightCompensation: 1; @@ -170,7 +177,7 @@ math { :lang(ja) { --RS__baseFontFamily: "游ゴシック体", YuGothic, "ヒラギノ丸ゴ", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", "MS Gothic", Roboto, Noto, "Noto Sans CJK JP", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; @@ -193,7 +200,7 @@ math { :lang(ko) { --RS__baseFontFamily: "Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", Roboto, Noto, "Noto Sans CJK KR", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } @@ -248,19 +255,19 @@ math { :lang(zh-Hant), :lang(zh-TW) { --RS__baseFontFamily: "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } :lang(zh-HK) { --RS__baseFontFamily: "方體", "PingFang HK", "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } -/* Readium CSS +/* Readium CSS Day/Default mode A preset theme for day mode, which is the default @@ -297,7 +304,7 @@ math { /* @import "modules/ReadiumCSS-fonts.css"; */ -/* Readium CSS +/* Readium CSS HTML5 SR Patch stylesheet A set of style to adjust HTML5 Suggested Rendering to paginated content @@ -316,15 +323,28 @@ figcaption, th, td { orphans: 1; } -h2, h3, h4, h5, h6, dt, -hr, caption { +h2, +h3, +h4, +h5, +h6, +dt, +hr, +caption { -webkit-column-break-after: avoid; page-break-after: avoid; break-after: avoid; } -h1, h2, h3, h4, h5, h6, dt, -figure, tr { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figure, +tr { -webkit-column-break-inside: avoid; page-break-inside: avoid; break-inside: avoid; @@ -342,9 +362,20 @@ body { hyphenate-limit-lines: 3; } -h1, h2, h3, h4, h5, h6, dt, -figcaption, pre, caption, address, -center, code, var { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figcaption, +pre, +caption, +address, +center, +code, +var { -ms-hyphens: none; -moz-hyphens: none; -webkit-hyphens: none; @@ -406,13 +437,13 @@ figure, blockquote { margin: 1em 5%; } -/* +/* :lang(ja) figure, :lang(ja) blockquote, :lang(zh-Hant) figure, :lang(zh-Hant) blockquote, :lang(zh-TW) figure, :lang(zh-TW) blockquote, :lang(mn) figure, :lang(mn) blockquote { - margin: 5% 1em; + margin: 5% 1em; } */ @@ -421,13 +452,13 @@ ul, ol { padding-left: 5%; } -/* +/* :lang(ja) ul, :lang(ja) ol, :lang(zh-Hant) ul, :lang(zh-Hant) ol, :lang(zh-TW) ul, :lang(zh-TW) ol, :lang(mn) ul, :lang(mn) ol { - padding-top: 5%; + padding-top: 5%; } */ @@ -436,13 +467,13 @@ dd { margin-left: 5%; } -/* +/* :lang(ja) dd, :lang(zh-Hant) dd, -:lang(zh-TW) dd, +:lang(zh-TW) dd, :lang(mn) dd { - margin-top: 5%; + margin-top: 5%; } */ @@ -479,19 +510,28 @@ ruby > rt, ruby > rp { *:lang(ja), *:lang(zh), *:lang(ko), -:lang(ja) cite, :lang(ja) dfn, :lang(ja) em, :lang(ja) i, -:lang(zh) cite, :lang(zh) dfn, :lang(zh) em, :lang(zh) i, -:lang(ko) cite, :lang(ko) dfn, :lang(ko) em, :lang(ko) i { +:lang(ja) cite, +:lang(ja) dfn, +:lang(ja) em, +:lang(ja) i, +:lang(zh) cite, +:lang(zh) dfn, +:lang(zh) em, +:lang(zh) i, +:lang(ko) cite, +:lang(ko) dfn, +:lang(ko) em, +:lang(ko) i { font-style: normal; } -:lang(ja) a, +:lang(ja) a, :lang(zh) a, :lang(ko) a { text-decoration: none; } -/* Readium CSS +/* Readium CSS Safeguards module for vertical writing A set of styles to prevent common issues in pagination @@ -507,7 +547,7 @@ ruby > rt, ruby > rp { --RS__maxMediaWidth: 100%; /* max-height for media, you can override that via JS if not compiled to static */ - --RS__maxMediaHeight: 100%; + --RS__maxMediaHeight: 100vw; /* value for medias’ box-sizing */ --RS__boxSizingMedia: border-box; diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-default.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-default.css similarity index 88% rename from r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-default.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-default.css index 6f9d326e..7122cfa6 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/cjk-vertical/ReadiumCSS-default.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/cjk-vertical/ReadiumCSS-default.css @@ -1,4 +1,19 @@ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Default module for CJK vertical writing A stylesheet for unstyled ebooks based on HTML5 Suggested Rendering @@ -32,6 +47,10 @@ --RS__secondaryColor: ; } +:root:lang(zh) { + --RS__paraIndent: 2em; +} + :lang("mn-Mong") { --RS__baseFontSize: 100%; } @@ -54,8 +73,14 @@ h1, h2, h3, h4, h5, h6 { /* Flow content */ -blockquote, figure, p, pre, -aside, footer, form, hr { +blockquote, +figure, +p, +pre, +aside, +footer, +form, +hr { margin-right: var(--RS__flowSpacing); margin-left: var(--RS__flowSpacing); } diff --git a/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/AccessibleDfA.otf b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/AccessibleDfA.otf new file mode 100755 index 00000000..69c02218 Binary files /dev/null and b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/AccessibleDfA.otf differ diff --git a/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/LICENSE-AccessibleDfa b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/LICENSE-AccessibleDfa new file mode 100755 index 00000000..bf56c051 --- /dev/null +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/LICENSE-AccessibleDfa @@ -0,0 +1,95 @@ +Copyright (c) Orange 2015, www.orange.com +with Reserved Font Name Accessible-Dfa. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + diff --git a/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/LICENSE-IaWriterDuospace.md b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/LICENSE-IaWriterDuospace.md new file mode 100755 index 00000000..3261f95c --- /dev/null +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/LICENSE-IaWriterDuospace.md @@ -0,0 +1,110 @@ +# IBM Plex Typeface + +Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + + +# IBM Type Code + +Copyright 2017 IBM +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/iAWriterDuospace-Regular.ttf b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/iAWriterDuospace-Regular.ttf new file mode 100755 index 00000000..7e75aa35 Binary files /dev/null and b/r2-navigator-swift/EPUB/Resources/Static/readium-css/fonts/iAWriterDuospace-Regular.ttf differ diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-after.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-after.css similarity index 91% rename from r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-after.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-after.css index 4284c835..280c34ac 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-after.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-after.css @@ -39,7 +39,22 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Pagination module A set of styles to paginate ePublications @@ -48,9 +63,9 @@ /* Config */ -/* Columns are responsive by default, even if column-width is set in pixels, +/* Columns are responsive by default, even if column-width is set in pixels, which means two-page spread will switch to single page depending on current font-size. - If you want more control, I’m afraid you’ll have to update colWidth/colGap dynamically, + If you want more control, I’m afraid you’ll have to update colWidth/colGap dynamically, which is how a significant amount of RS do at the moment. */ /* Default for smartphone portrait (small screens) */ @@ -79,7 +94,7 @@ } /* :root selector has same specificity as a class i.e. 0010 - We might have to change that to html / context + We might have to change that to html / context -> https://css-tricks.com/almanac/selectors/r/root/ */ :root { @@ -187,7 +202,7 @@ body { } } -/* Readium CSS +/* Readium CSS Scroll module A set of styles to scroll ePublications @@ -196,7 +211,7 @@ body { Repo: https://github.com/readium/readium-css */ :root[style*="readium-scroll-on"] { - + /* Reset columns, auto + auto = columns can’t be created */ -webkit-columns: auto auto !important; -moz-columns: auto auto !important; @@ -207,57 +222,16 @@ body { max-height: none !important; /* Reset html size so that the user can scroll */ min-width: 0 !important; - min-height: 0 !important; + min-height: 0 !important; } /* Make sure line-length is limited in all configs */ :root[style*="readium-scroll-on"] body { - --RS__maxLineLength: 40rem !important; - - margin-top: var(--RS__pageGutter) !important; - margin-bottom: var(--RS__pageGutter) !important; -} - -/* Scroll mode horizontal */ - -/* Vertical writing needs body height set */ - -/* Do we add a top/bottom margin for body in vertical scroll or not? */ - -/* Readium CSS - Default highlights - - A stylesheet for user highlights - - Repo: https://github.com/readium/readium-css */ - -/* User Highlights */ - -.readiumCSS-yellow-highlight { - background-color: rgba(255, 255, 0, 0.5); -} - -.readiumCSS-green-highlight { - background-color: rgba(0, 255, 0, 0.5); -} - -.readiumCSS-orange-highlight { - background-color: rgba(255, 165, 0, 0.5); + --RS__maxLineLength: 40rem !important; } -.readiumCSS-pink-highlight { - background-color: rgba(255, 105, 180, 0.5); -} - -/* Media overlays */ - -.readiumCSS-mo-active-default { - color: black !important; - background-color: yellow !important; -} - -/* Readium CSS +/* Readium CSS Night mode A preset theme for night mode @@ -303,8 +277,11 @@ body { color: var(--RS__visitedColor) !important; } +/* For epub:type, in case the contents are served as text/html, namespaces won’t work hence why we’re using both syntax */ + :root[style*="readium-night-on"] img[class*="gaiji"], -:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { +:root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, +:root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: invert(100%); filter: invert(100%); } @@ -330,7 +307,7 @@ body { filter: brightness(80%) invert(100%); } -/* Readium CSS +/* Readium CSS Sepia mode A preset theme for sepia mode @@ -355,11 +332,9 @@ body { /* we don’t need to redeclare bg-color and color for :root since we will inherit and update from day/default mode */ -:root[style*="readium-sepia-on"] body { - /* Should be transparent but Chrome bug https://bugs.chromium.org/p/chromium/issues/detail?id=711955&q=mix-blend-mode&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified */ - - color: inherit; - background-color: var(--RS__backgroundColor); +:root[style*="readium-sepia-on"] *:not(a) { + color: inherit !important; + background-color: transparent !important; } :root[style*="readium-sepia-on"] a:link, @@ -379,7 +354,7 @@ body { mix-blend-mode: multiply; } -/* Readium CSS +/* Readium CSS OS Accessibility Modes A stylesheet to deal with OS accessibility settings @@ -415,7 +390,8 @@ body { @media screen and (-ms-high-contrast: white-on-black) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -433,7 +409,8 @@ body { @media screen and (inverted-colors) { :root[style*="readium-night-on"] img[class*="gaiji"], - :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child { + :root[style*="readium-night-on"] *[epub\:type~="titlepage"] img:only-child, + :root[style*="readium-night-on"] *[epub|type~="titlepage"] img:only-child { -webkit-filter: none !important; filter: none !important; } @@ -456,7 +433,7 @@ body { /* If reduced motion is set on MacOS, in case we have animation/transition */ } -/* Readium CSS +/* Readium CSS Columns number pref A submodule managing columns number for user settings @@ -494,7 +471,7 @@ body { } } -/* Readium CSS +/* Readium CSS Page margins pref A submodule managing page margins for user settings @@ -508,7 +485,7 @@ body { padding: 0 calc(var(--RS__pageGutter) * var(--USER__pageMargins)) !important; } -/* Readium CSS +/* Readium CSS Custom colors pref A submodule managing custom colors for user settings @@ -532,7 +509,7 @@ body { color: inherit !important; } -/* Readium CSS +/* Readium CSS Text align pref A submodule managing text-align for user settings @@ -569,7 +546,7 @@ body { text-align: right; } -/* Readium CSS +/* Readium CSS Font Family pref A submodule managing font-family for user settings @@ -605,7 +582,7 @@ body { font-family: inherit !important; } -/* Readium CSS +/* Readium CSS Font size pref A submodule managing font-size for user settings @@ -617,7 +594,7 @@ body { font-size: var(--USER__fontSize) !important; } -/* Readium CSS +/* Readium CSS Line height pref A submodule managing line-height for user settings @@ -636,7 +613,7 @@ body { line-height: inherit; } -/* Readium CSS +/* Readium CSS Para spacing pref A submodule managing paragraphs’ top and bottom margins for user settings @@ -649,7 +626,7 @@ body { margin-bottom: var(--USER__paraSpacing) !important; } -/* Readium CSS +/* Readium CSS Para indent pref A submodule managing paragraphs’ text-indent for user settings @@ -668,7 +645,7 @@ body { text-indent: 0 !important; } -/* Readium CSS +/* Readium CSS Ligatures pref A submodule managing ligatures for user settings in the Arabic Script (can help with a11y) @@ -684,7 +661,7 @@ body { font-variant-ligatures: inherit !important; } -/* Readium CSS +/* Readium CSS Font size normalize A stylesheet to normalize font-size @@ -743,7 +720,7 @@ body { font-size: 67.5% !important; } -/* The following styles kick in if you define the typeScale variable in the DOM. +/* The following styles kick in if you define the typeScale variable in the DOM. No need to repeat declarations which don’t make use of the variable */ :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h1 { @@ -757,4 +734,44 @@ body { :root[style*="readium-advanced-on"][style*="--USER__typeScale"] h3 { font-size: calc(1rem * var(--USER__typeScale)) !important; } + +/* Readium CSS + Default highlights + + A stylesheet for user highlights + + Repo: https://github.com/readium/readium-css */ + +/* User Highlights */ + +.readiumCSS-yellow-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-yellow-highlight, +:root[style*="readium-night-on"] .readiumCSS-yellow-highlight { + background-color: rgba(255, 255, 0, 0.5) !important; +} + +.readiumCSS-green-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-green-highlight, +:root[style*="readium-night-on"] .readiumCSS-green-highlight { + background-color: rgba(0, 255, 0, 0.5) !important; +} + +.readiumCSS-orange-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-orange-highlight, +:root[style*="readium-night-on"] .readiumCSS-orange-highlight { + background-color: rgba(255, 165, 0, 0.5) !important; +} + +.readiumCSS-pink-highlight, +:root[style*="readium-sepia-on"] .readiumCSS-pink-highlight, +:root[style*="readium-night-on"] .readiumCSS-pink-highlight { + background-color: rgba(255, 105, 180, 0.5) !important; +} + +/* Media overlays */ + +.readiumCSS-mo-active-default { + color: black !important; + background-color: yellow !important; +} /*# sourceMappingURL=ReadiumCSS-after.css.map */ \ No newline at end of file diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-before.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-before.css similarity index 95% rename from r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-before.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-before.css index 28778589..dcb79fff 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-before.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-before.css @@ -39,10 +39,10 @@ /* Direction i.e. ltr and rtl */ -/* Readium CSS - Base module +/* Readium CSS + Namespaces module - A minimal stylesheet for all ebooks + Namespaces to import in all 3 dist stylesheets Repo: https://github.com/readium/readium-css */ @@ -54,6 +54,13 @@ @namespace svg url("http://www.w3.org/2000/svg"); +/* Readium CSS + Base module + + A minimal stylesheet for all ebooks + + Repo: https://github.com/readium/readium-css */ + /* Define viewport, HTML5-style */ @-ms-viewport { @@ -75,7 +82,7 @@ /* Config */ --RS__baseFontFamily: var(--RS__oldStyleTf); - + /* For square-ish fonts (CJK, Indic, etc.), we must apply some compensation in dynamic leading. Default is 1 i.e. no compensation */ --RS__lineHeightCompensation: 1; @@ -170,7 +177,7 @@ math { :lang(ja) { --RS__baseFontFamily: "游ゴシック体", YuGothic, "ヒラギノ丸ゴ", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", "MS Gothic", Roboto, Noto, "Noto Sans CJK JP", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; @@ -193,7 +200,7 @@ math { :lang(ko) { --RS__baseFontFamily: "Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", Roboto, Noto, "Noto Sans CJK KR", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } @@ -248,19 +255,19 @@ math { :lang(zh-Hant), :lang(zh-TW) { --RS__baseFontFamily: "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } :lang(zh-HK) { --RS__baseFontFamily: "方體", "PingFang HK", "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", Roboto, Noto, "Noto Sans CJK TC", sans-serif; - + /* For CJK, the line-height is usually 15–20% more than for Latin */ --RS__lineHeightCompensation: 1.167; } -/* Readium CSS +/* Readium CSS Day/Default mode A preset theme for day mode, which is the default @@ -297,7 +304,7 @@ math { /* @import "modules/ReadiumCSS-fonts.css"; */ -/* Readium CSS +/* Readium CSS HTML5 SR Patch stylesheet A set of style to adjust HTML5 Suggested Rendering to paginated content @@ -316,15 +323,28 @@ figcaption, th, td { orphans: 1; } -h2, h3, h4, h5, h6, dt, -hr, caption { +h2, +h3, +h4, +h5, +h6, +dt, +hr, +caption { -webkit-column-break-after: avoid; page-break-after: avoid; break-after: avoid; } -h1, h2, h3, h4, h5, h6, dt, -figure, tr { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figure, +tr { -webkit-column-break-inside: avoid; page-break-inside: avoid; break-inside: avoid; @@ -342,9 +362,20 @@ body { hyphenate-limit-lines: 3; } -h1, h2, h3, h4, h5, h6, dt, -figcaption, pre, caption, address, -center, code, var { +h1, +h2, +h3, +h4, +h5, +h6, +dt, +figcaption, +pre, +caption, +address, +center, +code, +var { -ms-hyphens: none; -moz-hyphens: none; -webkit-hyphens: none; @@ -406,13 +437,13 @@ figure, blockquote { margin: 1em 5%; } -/* +/* :lang(ja) figure, :lang(ja) blockquote, :lang(zh-Hant) figure, :lang(zh-Hant) blockquote, :lang(zh-TW) figure, :lang(zh-TW) blockquote, :lang(mn) figure, :lang(mn) blockquote { - margin: 5% 1em; + margin: 5% 1em; } */ @@ -421,13 +452,13 @@ ul, ol { padding-left: 5%; } -/* +/* :lang(ja) ul, :lang(ja) ol, :lang(zh-Hant) ul, :lang(zh-Hant) ol, :lang(zh-TW) ul, :lang(zh-TW) ol, :lang(mn) ul, :lang(mn) ol { - padding-top: 5%; + padding-top: 5%; } */ @@ -436,13 +467,13 @@ dd { margin-left: 5%; } -/* +/* :lang(ja) dd, :lang(zh-Hant) dd, -:lang(zh-TW) dd, +:lang(zh-TW) dd, :lang(mn) dd { - margin-top: 5%; + margin-top: 5%; } */ @@ -479,19 +510,28 @@ ruby > rt, ruby > rp { *:lang(ja), *:lang(zh), *:lang(ko), -:lang(ja) cite, :lang(ja) dfn, :lang(ja) em, :lang(ja) i, -:lang(zh) cite, :lang(zh) dfn, :lang(zh) em, :lang(zh) i, -:lang(ko) cite, :lang(ko) dfn, :lang(ko) em, :lang(ko) i { +:lang(ja) cite, +:lang(ja) dfn, +:lang(ja) em, +:lang(ja) i, +:lang(zh) cite, +:lang(zh) dfn, +:lang(zh) em, +:lang(zh) i, +:lang(ko) cite, +:lang(ko) dfn, +:lang(ko) em, +:lang(ko) i { font-style: normal; } -:lang(ja) a, +:lang(ja) a, :lang(zh) a, :lang(ko) a { text-decoration: none; } -/* Readium CSS +/* Readium CSS Safeguards module A set of styles to prevent common issues in pagination @@ -506,7 +546,7 @@ ruby > rt, ruby > rp { /* max-width for media, you can override that via JS if not compiled to static */ --RS__maxMediaWidth: 100%; - /* max-height for media, you can override that via JS if not compiled to static + /* max-height for media, you can override that via JS if not compiled to static Please consider figures might have a figcaption, which is why 95vh in the first place */ --RS__maxMediaHeight: 95vh; diff --git a/r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-default.css b/r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-default.css similarity index 84% rename from r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-default.css rename to r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-default.css index 83a5dd84..18bb8931 100644 --- a/r2-navigator-swift/EPUB/Resources/Static/styles/rtl/ReadiumCSS-default.css +++ b/r2-navigator-swift/EPUB/Resources/Static/readium-css/rtl/ReadiumCSS-default.css @@ -1,4 +1,19 @@ -/* Readium CSS +/* Readium CSS + Namespaces module + + Namespaces to import in all 3 dist stylesheets + + Repo: https://github.com/readium/readium-css */ + +@namespace url("http://www.w3.org/1999/xhtml"); + +@namespace epub url("http://www.idpf.org/2007/ops"); + +@namespace m url("http://www.w3.org/1998/Math/MathML/"); + +@namespace svg url("http://www.w3.org/2000/svg"); + +/* Readium CSS Default module for RTL scripts A stylesheet for unstyled ebooks based on HTML5 Suggested Rendering @@ -42,19 +57,30 @@ h1, h2, h3, h4, h5, h6 { /* Flow content */ -blockquote, figure, p, pre, -aside, footer, form, hr { +blockquote, +figure, +p, +pre, +aside, +footer, +form, +hr { margin-top: var(--RS__flowSpacing); margin-bottom: var(--RS__flowSpacing); } p { margin-top: var(--RS__paraSpacing); - margin-bottom: var(--RS__paraSpacing); + margin-bottom: var(--RS__paraSpacing); text-indent: var(--RS__paraIndent); } -h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p, +h1 + p, +h2 + p, +h3 + p, +h4 + p, +h5 + p, +h6 + p, hr + p { text-indent: 0; } diff --git a/r2-navigator-swift/EPUB/UserSettings.swift b/r2-navigator-swift/EPUB/UserSettings.swift index b420c05d..4a70cef6 100644 --- a/r2-navigator-swift/EPUB/UserSettings.swift +++ b/r2-navigator-swift/EPUB/UserSettings.swift @@ -18,7 +18,7 @@ public class UserSettings { // WARNING: String values must not contain any single or double quotes characters, otherwise it breaks the streamer's injection. private let appearanceValues = ["readium-default-on", "readium-sepia-on","readium-night-on"] - private let fontFamilyValues = ["Original", "Helvetica Neue", "Iowan Old Style", "Athelas", "Seravek", "OpenDyslexic"] + private let fontFamilyValues = ["Original", "Helvetica Neue", "Iowan Old Style", "Athelas", "Seravek", "OpenDyslexic", "AccessibleDfA", "IA Writer Duospace"] private let textAlignmentValues = ["justify", "start"] private let columnCountValues = ["auto", "1", "2"]