Comments (4)
This worked for me:
custom: {
families: [{
name: 'Mainson Neue',
src: './src/fonts/regular/*',
},
{
name: 'Mainson Neue Extended',
src: './src/fonts/extended/*',
}],
},
from unplugin-fonts.
OK, That's what I did and I see that the fonts are indeed loaded 👍
custom: {
families: [{
name: 'Rubik',
src: './src/assets/fonts/Rubik/*'
}],
},
In src/assets/fonts/Rubik/
directory there are a few fonts (Rubik-Medium.ttf / Rubik-Regular.ttf / etc.)
But when I tried to use a specific font, for example fontFamily: 'Rubik-Medium'
, no Rubik's font was shown, and when I tried fontFamily: 'Rubik'
then the Rubik-Regular
font is displayed
What is the correct way to use it?
Thanks
from unplugin-fonts.
Well i guess you should see a font.css with the @font-face stacked within the family added to your html.
The Medium, Light, Regular and Bold are added as versions of the font, so when you use font-family: "Rubik"
it uses the regular version, and if you use <bold>This is bold</bold>
it uses the bold version of the font.
This i how @font-face is built, the browser switches between versions based on css og html elements.
This plugin reads the filenames i belive and adds @font-face attributes based on that.
So the Bold gets font-weight: 700;
, italic gets font-style:italic;
and bold-italic gets both.
Dont know if that made things any better 😆
from unplugin-fonts.
Hi there!
This has been fixed in the v1.0.0
Feel free to reopen the issue if it persists!
from unplugin-fonts.
Related Issues (20)
- Dont work in dev mode HOT 7
- ERR_REQUIRE_ESM with Vite 3.1.5 HOT 1
- Fonts for nested routes are not loaded properly HOT 2
- Using with typescript HOT 1
- Support weight prefixed local fonts HOT 2
- Error on start: TypeError: VitePluginFonts is not a function HOT 2
- files in the public directory are served at the root path. HOT 2
- [Bug]: Font not loading in Sveltekit HOT 3
- Is this tool downloads fonts? HOT 3
- [Bug]: Not working after switch from vite-plugin-fonts HOT 6
- [Bug]: Type custom did not generate @font-face HOT 3
- [Bug]: Unfonts not callable HOT 2
- [Bug]: SvelteKit example doesn't build HOT 3
- [Bug]: Latest fontsouce versions >5 does not work with variable fonts
- [Bug]: Issues with astro (example and Astro 3) HOT 3
- [Bug]: Can't find fontsource font files in Nuxt 3 HOT 2
- [Feature]: Add support for vite 5
- Support Vite 5.0 HOT 1
- [Bug]: typekit Get Url error
- [Bug]: Local fonts are note preloaded in Vite 5 since v1.1.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unplugin-fonts.