javascript - 如何将自定义 fontFamily 添加到 reacr-reader npm
解决方案
import React, { useState,useRef } from "react"
import { ReactReader } from "react-reader"
const App = () => {
const [location, setLocation] = useState(null)
const renditionRef = useRef(null);
return (
<div style={{ height: "100vh" }}>
<ReactReader
location={location}
locationChanged={ (epubcifi)=>setLocation(epubcifi)}
url="https://gerhardsletten.github.io/react-reader/files/alice.epub"
getRendition={(rendition) => {
renditionRef.current = rendition;
renditionRef.current.themes.register('custom', {
p: {
'font-family': `Helvetica`,
},
});
renditionRef.current.themes.select('custom');
}}
/>
</div>
)
}
export default App
推荐阅读
- javascript - 我无法通过 JQuery 解析 JSON
- php - 在 WooCommerce 上用 JS Sweet Alert 替换“已添加到购物车”通知
- firebase - 如何使用 Post Url 使用 uid 将文件上传到 Firebase 存储?
- replace - 将 Lua 中的每个 " 替换为 \"
- android - 如何在没有 AAPT 错误的情况下正确迁移到 Android X 支持库?
- javascript - 使用 JavaScript 验证 HTML 表单
- java - 自定义布局按钮在 AlertDialog 中不起作用
- pytorch - 如何将模型从 torch 转换为 pytorch 或 caffe 或任何其他模型?
- authentication - 由于缺少 Kerberos 票证,纱线应用程序命令挂起
- javascript - Chrome 扩展程序。将txt文件读入数组。JavaScript