1

I'm using react-reader npm and I cant put my custom font-family in my project. Does anyone know the answer of this ?

https://www.npmjs.com/package/react-reader

fatemeh kazemi
  • 516
  • 6
  • 10

1 Answers1

2
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
Shubham
  • 41
  • 6