You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CSS09-default_fonts.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -497,4 +497,10 @@ Implementers might want to load this patch only if they find one of the followin
497
497
- version 1: `<dc:description id="ebpaj-guide">ebpaj-guide-1.0</dc:description>`
498
498
- version 1.1: `<meta property="ebpaj:guide-version">1.1</meta>`
499
499
500
-
Since `@font-face` must be used to align with EBPAJ’s specific implementation (rendering engines have to go through 9–11 `local` sources in the worst-case scenario), implementers should expect a performance debt.
500
+
Since `@font-face` must be used to align with EBPAJ’s specific implementation (rendering engines have to go through 9–11 `local` sources in the worst-case scenario), implementers should expect a performance debt.
501
+
502
+
## Android System Generic families Patch
503
+
504
+
In beta versions of Readium CSS 2, we introduced a patch for Times, Times New Roman, Arial, and Helvetica, relying on Nimbus Sans and Nimbus Roman as metric-compatible replacements on Android devices. It can be critical for Fixed-Layout publications using these fonts without having embedded their fonts.
505
+
506
+
Since we cannot provide `@font-face` rules for system fonts, this patch was not included in the final version of Readium CSS 2 and you will need to implement it yourself if you want to support these fonts on Android.
Now that we have seen libre and variable fonts, let's see how to use custom fonts with Readium CSS.
6
+
7
+
Readium CSS cannot provide `@font-face` rules, as this would require apps to embed fonts in every EPUB file they render, at a specific path relative to the current resource displayed. This does not scale, would bloat file sizes, and would not resolve the issue of previewing these fonts in the app itself.
8
+
9
+
## Declaring fonts
10
+
11
+
Apps can declare custom fonts by injecting `@font-face` rules into the content’s `head` element. It is critical that these rules are injected in each content resource, as the browser needs to resolve the `font-family` values used in the Readium CSS stylesheet.
<p>Since <code>@font-face</code> must be used to align with EBPAJ’s specific implementation (rendering engines have to go through 9–11 <code>local</code> sources in the worst-case scenario), implementers should expect a performance debt.</p>
<h2id="sigil_toc_id_220">Android System Generic families Patch</h2>
963
+
964
+
<p>In beta versions of Readium CSS 2, we introduced a patch for Times, Times New Roman, Arial, and Helvetica, relying on Nimbus Sans and Nimbus Roman as metric-compatible replacements on Android devices. It can be critical for Fixed-Layout publications using these fonts without having embedded their fonts.</p>
965
+
966
+
<p>Since we cannot provide <code>@font-face</code> rules for system fonts, this patch was not included in the final version of Readium CSS 2 and you will need to implement it yourself if you want to support these fonts on Android.</p>
<p>Now that we have seen libre and variable fonts, let's see how to use custom fonts with Readium CSS.</p>
19
+
20
+
<p>Readium CSS cannot provide <code>@font-face</code> rules, as this would require apps to embed fonts in every EPUB file they render, at a specific path relative to the current resource displayed. This does not scale, would bloat file sizes, and would not resolve the issue of previewing these fonts in the app itself.</p>
21
+
22
+
<sectionid="declaring-fonts" class="level2">
23
+
<h2id="sigil_toc_id_221">Declaring fonts</h2>
24
+
25
+
<p>Apps can declare custom fonts by injecting <code>@font-face</code> rules into the content’s <code>head</code> element. It is critical that these rules are injected in each content resource, as the browser needs to resolve the <code>font-family</code> values used in the Readium CSS stylesheet.</p>
<h2id="sigil_toc_id_222">Applying a custom font</h2>
65
+
66
+
<p>Once you have declared a custom font, you can apply it to elements in your EPUB content by using the <code>--USER__fontFamily</code> property of Readium CSS.</p>
0 commit comments