Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How can we add a custom font to the website

By
Sebastiaan
on 2/28/15, 12:21 PM 1,669 views

We run into some basic problems when trying to build our custom website with Odoo. Hopefully we find help here.

I have converted two lettertypes to webfonts which we would like to use on our website. Is there a specific location where we should place these maps? How can we chance the default lettertypes 1 and 2 for our website to these ones?

 

 

0
Sebastiaan
On 3/4/15, 3:25 AM

(Edi)

Think we figured it out:

If you add the following HTML code at the top of a page via the Odoo HTML editor:

<t t-name="website.PAGENAME">

    <t t-call="website.layout">

        <style>

            h1 {font-family: "Comic Sans MS", cursive, sans-serif; font-size:50px;}

        </style>

    </t>

</t> 

You will see that each H1 text (on that page only) is concverted to comic sans 50px. If you never use H6 on your website you may better declare H6 so you are still flexible to use H1 in the theme lettertype as well on that page if you want.

This method works for all websafe fonts, you can copy paste them here  http://www.w3schools.com/cssref/css_websafe_fonts.asp

We wanted however a different font, at http://www.fontsquirrel.com/tools/webfont-generator you can upload your font (make sure you have the correct licence) and let it generate a web-font kit. Upload the whole kit to your server, in the kit there is a generated stylesheet.css which contains the code you can probably also add to the frontend.css which your theme uses. If you did this the above HTML code should also allow to use that custom font (we are still checking, will update if we are wrong or found out more)

(ignore below comments)

We now figured it out our selves I think. Via fontsquirrel you can upload a font (make sure you own of use free licence) and have the tool directly creaste an css file in your created package. That css (multiple declarations to support all kind of devices and browsers) file contains the code you can add to the frontend.ss of the theme you want to use it in. Then for each page where you like to use that font only for H1 simply add a piece of code at the start looking like this: t t-name="website.NAMEOFPAGE"> When you now add a buildingblock to that page and add H1 text in that black it is in the custom lettertype. Any H1 text on other pages will still be original font. We are pretty much there but still need to fully validate above method. Maybe good to mention that a lot of web safe fonts are already delivered with Odoo (I write this for noobs like myself) so without adding thing to your CSS file you can already choose a many custom fonts in you pages by for example adding Creates COMIC SANCE in size 50 when choosing H1...this mentod you can also choose another one for H2 etc. Hope it helps somebody who encounters the same question.

Sebastiaan
on 3/10/15, 4:56 AM

FOR SOME REASON ABOVE COMMENTS MISSES IMPORTENT PARTS OF THE TEXT. I CAN NOT ADD ANOTHER POST TO THIS THREAD TO EXPLAIN HOW TO DO THIS SO IF YOU HAVE THE SAME PROBLEM SIMLY REPLY AND I CAN TRY TO HELP

Sebastiaan
on 3/10/15, 5:00 AM

how to embed custom font in odoo website(browser) ?font-type=Freight ??? how can i add my custom font in website? did you got any proper solution for that??

Logicious
on 2/10/16, 7:14 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/28/15, 12:21 PM
Seen: 1669 times
Last updated: 3/16/15, 8:10 AM