Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

font-face object passed directly doesn't work #243

Open
omerzach opened this issue Jun 5, 2017 · 6 comments
Open

font-face object passed directly doesn't work #243

omerzach opened this issue Jun 5, 2017 · 6 comments

Comments

@omerzach
Copy link
Contributor

omerzach commented Jun 5, 2017

I'm on Aphrodite 1.2.1.

I have

const Raleway = {
  fontFamily: "Raleway",
  fontStyle: "normal",
  fontWeight: "normal",
  src: "url('https://fonts.googleapis.com/css?family=Raleway') format('woff2')",
};

This works:

const styles = StyleSheet.create({
  title: {
    fontFamily: [Raleway],
  },
});

This doesn't:

const styles = StyleSheet.create({
  title: {
    fontFamily: Raleway,
  },
});

According to the README either one should work:

"We've made it so that the fontFamily property can accept a font-face object (either directly or inside an array)."

@xymostech
Copy link
Contributor

Thanks for the report! Yeah, that definitely should work. I wonder why it doesn't...

Can you be more specific about what you mean by "This doesn't work"? Does it throw an error? Or just not insert the font face? What do you get as the font-family value in that style?

@omerzach
Copy link
Contributor Author

omerzach commented Jun 5, 2017

Yep, sorry :)

No errors, and the @font-face does appear to be getting added correctly, but the Chrome web inspector shows font-family: "undefined" and the text is rendered with the default font.

@dwayne-roberts
Copy link

Adding it in the proposed way, stipulated in the readme also does not seem to work for me. Just like with @omerzach it injects the @font-face rule correctly in the <HEAD /> but the font-family style is undefined

@neildevas
Copy link

has there been a workaround for this? even when passing the font the first way you did it, ([Raleway]) rather than passing directly, it doesnt work for me. Chrome inspector and the debugger both show that the font is defined correctly but my elements arent showing up with the correct font

@omerzach
Copy link
Contributor Author

@neildevas:

I think this PR fiexes the issue: #252

The array-passing thing definitely works for us though, so @xymostech's questions for me when I first posted this are probably relevant: "Can you be more specific about what you mean by 'This doesn't work'? Does it throw an error? Or just not insert the font face? What do you get as the font-family value in that style?"

@neildevas
Copy link

@omerzach
screen shot 2017-07-12 at 12 27 47 pm
it doesnt insert the font face. when i look at the actual object the font family in the debugger, everything is defined, including the font family

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants