Including font in custom theme

Hi,

I am trying to include a font in my custom theme but not exactly sure how I am suppose to do this. I have a CSS declaration for font-face and this declaration in my atlassian-plugin file under web-resource:

<resource name="custom-font.ttf" type="download" location="/fonts/custom-font.ttf"></resource>

Does anyone know what else I am suppose to do to be able to use a font in a custom theme?

1 answer

Hi,

this is an example of how I implemented fonts in a plugin:

1.  Add all font resources, including the CSS file with font-face declaration, to a single font folder

2.  Add the web resource and file locations to atlassian-plugin.xml

&lt;web-resource key="plugin-fonts-css" name="Plugin Fonts CSS"&gt;
    &lt;resource name="plugin-fonts.css" type="download" location="/plugin/fonts/plugin-fonts.css"/&gt;
    &lt;resource name="plugin.otf" type="download" location="/plugin/fonts/plugin.otf"&gt;&lt;/resource&gt;
    &lt;resource name="plugin.eot" type="download" location="/plugin/fonts/plugin.eot"&gt;&lt;/resource&gt;
    &lt;resource name="plugin.svg" type="download" location="/plugin/fonts/plugin.svg"&gt;&lt;/resource&gt;
    &lt;resource name="plugin.ttf" type="download" location="/plugin/fonts/plugin.ttf"&gt;&lt;/resource&gt;
    &lt;resource name="plugin.woff" type="download" location="/plugin/fonts/plugin.woff"&gt;&lt;/resource&gt;
&lt;/web-resource&gt;


3.  In your velocity template add:

#requireResource("com.adaptavist.confluence.plugin:plugin-fonts-css")


4.   Add the required classes to the HTML in the velocity

Compared to your example I would say that the CSS file needs to be included with your web-resource for the font.

 

Hope this helps.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted an hour ago in United States

Let's get to know each other!

Let's use this thread to introduce ourselves. If you can highlight where you work, your role and what Atlassian tools you use, this will be a good way for folks to get to know one another. It's a...

41 views 5 2
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you