Hi guys,
Is it possible to support custom Fonts in Swift without messing with the CSS files?
Thank you,
Adrian
Hi guys,
Is it possible to support custom Fonts in Swift without messing with the CSS files?
Thank you,
Adrian
Nope, not yet.
Since custom fonts can be external urls in various versions or file uploads, we have not looked into it yet.
So on website settings, add a custom header include razor template (example attached) and include the required fonts and css in that file.
Hi Nicolai,
Thank you for the suggestion.
I have asked about this because I had the impression that it was already supported (based on the beta presentation).
I guess I have misunderstood the answer back then.
The custom font has implications at the branding level.
I assume the information for the Google fonts is some sort of json with the available configuration. Maybe if we can add a custom data structure to mimic the Gogle Font one, this can be accomplished on 2 steps:
1. Include the file in the header
2. Set up the configuration file that would give access to the font variations and weights.
I don't expect this to be automatic. Having a way to insert something custom in the existing Google font control might make it more flexible on the long run.
Thank you,
Adrian
The Google font selector uses Google font API directly, so you cannot replace that easily.
So the custom font will be a couple of new fields on branding to use - a url to the font , a piece of css, name of the font etc. to allow for you to specify what is needed to overwrite what ends up in the generated css file.
With my proposed solution above, you inject the font file in the header and simply override the correct "--swift-*" css variables from you custom css and you are done. It is already very simple - will make an example of how to do it.
Hi Nicolai,
Thank you. It is important to know that this will be the official solution moving forward
I will try it out.
Thank you,
Adrian
Yeah - we are still writing the docs that will cover all kinds of customisations - including this one!
Hi I've also tried to add a custom font through backoffice configuration using these steps:
To make your Swift solution ready for custom fonts, you have to create a new page in the design folder.
from you guide on: https://doc.dynamicweb.com/swift/setup-project/design/branding
However in the 3rd step, Fonts Collection is not an option and there is no item corresponding to it.
It is a relatively new feature, so you need a version of Swift that supports custom fonts. So you need 1.15 or newer to have that feature. Checkout the list of versions and features added here: https://github.com/dynamicweb/Swift/releases
You must be logged in to post in the forum