Open tpreusse opened 6 years ago
Do we need font-manager or just being able to just pass many font-families on styles? such as the web? The thing about font-manager is that I cannot add it to the react-pdf substitution engine because it’s not installable on the web. We can either follow a solution like the one above, or make a custom republik font-substitution engine
I think it should be an API like this:
import { Font } from '@react-pdf/core'
const substitutionCallback = (postscriptName, char) => {
// get a font instance
}
Font.registerSubstitutionCallback(substitutionCallback);
This would follow internally to fontSubstitutionEngine
via the LayoutEngine
.
@react-pdf/node
could then set a default substitutionCallback
powered by font-manager
. On the web someone could implement this callback to feed in a large fallback font, but most will not want to because of the associated size.
being able to just pass many font-families on styles?
Not sure how important that one is. Generally I wouldn't want to specify Helvetica
everywhere because 0.1% of my documents may contain a odd Cyrillic or Han line.
I also realised that it makes sense to fallback to the system Helvetica after trying the asm Helvetica, since the asm file has a small subset of what probably most system Helvetica have. The original substitution engine probably had this strange loading from font-manager
in many or most cases because of that.
http://localhost:3007/2018/05/11/russlands-staatsfeind-nummer-eins.pdf (prd)
on local version (
@react-pdf/core@0.7.7-24
)on prd version (
@react-pdf/core@0.7.7-22
)on the web
Ultimately we do need font manager. As long as we're SSR-Rendering we should get the benefit of being able to access system fonts for such cases.