Giter Site home page Giter Site logo

Comments (4)

espensgr avatar espensgr commented on June 4, 2024

This worked for me:

custom: {
  families: [{
    name: 'Mainson Neue',
    src: './src/fonts/regular/*',
  },
  {
    name: 'Mainson Neue Extended',
    src: './src/fonts/extended/*',
  }],
},

from unplugin-fonts.

belaziv avatar belaziv commented on June 4, 2024

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.

espensgr avatar espensgr commented on June 4, 2024

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.

stafyniaksacha avatar stafyniaksacha commented on June 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.