Styling text
Kirkman opened this issue · 7 comments
When configuring an object of type text
in layers.js, I see that I can set fontFamily, and fontSrc.
However, it seems like there are not equivalent fontStyle and fontWeight properties.
Is there a way I can set font weight for a text object ala css font-weight
? I'm hoping to be able to use the black weight of our primary font, but without that property I'm not sure how I would do it.
Hey @Kirkman, good shout - this isn't currently possible but should be fairly trivial to add. CardKit depends on rvg.js
which creates the actual SVG CardKit renders, and I've just been able to locally add support for font-weight
.
I'll fix up a new release for rvg.js
tomorrow and then update CardKit respectively so that you can pass a font weight through in your configuration. I'll post here again when that's done!
Even better, found half an hour to do it now - currently done as PR #71, I'll have this reviewed and pushed under a new CardKit version tomorrow!
Hey @Kirkman, all done! If you update to cardkit@2.0.5
you should be able to use the new fontWeight
property.
See https://github.com/times/cardkit/releases/tag/v2.0.5 for a simple example, and let me know if that works for you
@chrishutchinson If I use npm install cardkit --save
will I get this updated version?
Yep @Kirkman, that should do the trick! Let me know if not
So, this didn't seem to do the trick. My fonts were still rendering at 'normal' instead of bold or black. I putzed around and found adding a line to dom.js seemed to fix it. I made a pull request here:
https://github.com/times/cardkit/pull/73
And I also realized it would be nice to have a slider control to allow our users here to adjust font-weight. So here's another pull request for that: https://github.com/times/cardkit/pull/74