michelson/dante2

Adjust font weight imports?

Closed this issue · 4 comments

First off - Dante2 is really cool, I love the project. Thanks so much for working on it.

We're just wondering if it'd be possible to adjust the font weights that get imported, specifically to remove some.

We already use Open Sans but 800 is a little too bold for us (we prefer 600), and when Dante2 imports any other package that applies font-weight: bold gets knocked up to 800.

Is it conceivably possible to dequeue a font or specify our own?

We're using Dante2@0.5.0-rc25and react@^16.8.0

you could extend the styles.

example:

import styled from '@emotion/styled'

const DanteStylesExtend  = styled(DanteContainer)`
font-weight: ...;
.graf--p{
  width: 242px;
  overflow: auto
}

<EditorStylesExtend >
    <DanteEditor ...>
</EditorStylesExtend >
`

let me know if that helps

@michelson Wow, thanks for the very fast reply!

Correct me if I'm misunderstanding, but won't that simply override the default styles from Dante2?
We're hoping to prevent it from importing certain font-weights from Google Fonts altogether.

Like how in https://github.com/michelson/dante2/blob/master/src/editor/styled/base.js we have the line @import url('//fonts.googleapis.com/css?family=Merriweather:400,700,400italic,700italic|Open+Sans:400,300,800');

We'd ideally want to prevent loading Open+Sans:800 altogether...or else remove it after load or something.

you could extend or create a new instance, I think for now the workaround for you is to replace the style completely.
said that, I would be interesting to handle the fonts passing props to the <EditorStyles > like <EditorStyles fonts= [...] />

maybe you can spin a new PR with that ?

Might give that a shot, I'll let you know if I have any luck!