ae9is / react-fontpicker Goto Github PK
View Code? Open in Web Editor NEWA Google font picker for React
Home Page: https://ae9is.github.io/react-fontpicker/
License: MIT License
A Google font picker for React
Home Page: https://ae9is.github.io/react-fontpicker/
License: MIT License
There isn't any way to change the styling right now. I tried the styles.css selectors references but the font selector breaks.
Could rewrite font preview generation to generate SVG font previews at some point
ref: https://github.com/ae9is/react-fontpicker/tree/main/packages/fontpicker/scripts#notes
I was using your great component to set the font in Redux state and use its value in a canvas, but I encountered a problem where the canvas was re-rendering faster than the font could load.
so there was no change in canvas
"I fixed this problem by adding import FontFaceObserver from "fontfaceobserver";"
` const handleFontChange = (font) => {
const fontObserver = new FontFaceObserver(font);
fontObserver.load().then(() => {
dispatch(
setSettings({
...settings,
printAreas: settings.printAreas.map((area) =>
area.id === printArea.id
? { ...area, texts: area.texts.map((t) => (t.id === textId ? { ...t, font: font } : t)) }
: area
),
})
);
});
};
`
I suggest adding this library directly in the component, so that the value returned in value={(font) => { example(font); }}
is only returned after the font has finished loading ; )
Hello,
I'm trying to make this work with my app, but the defaultValue looks like it's only working the first time the font picker mounts.
This is the small code where I see it's not working:
<FontPicker defaultValue={currentLayer.font} value={(font) => handleValueChange(font, "font")} />
should be: {currentLayer.font}
The should be part is updating correctly, but not the picker.
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.