コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
22007 ビュー

I want to add my custom font to website theme editor > options > font family.

That custom font isn't related to "Google Web Fonts" and it has its own folder and files.

I'm using Odoo 14 with default theme.

tnx.

アバター
破棄

@Misaghmi

Have you found any solution?

最善の回答

you need to follow these steps:

  1. Prepare your custom font files: Make sure you have the necessary font files in the proper formats (e.g., .woff, .woff2, .ttf, etc.) for your custom font. Place these font files in a directory within your Odoo module.

  2. Define the font in your Odoo module's assets: In your module, create a static assets directory (e.g., static/src/fonts) and place your custom font files in this directory. Also, create a CSS file (e.g., static/src/css/custom_fonts.css) to define the font face rules.

  3. Define the font face rules: In the custom_fonts.css file, define the @font-face rules for your custom font. For example:

@font-face {
font-family: 'YourCustomFontName';
src: url('/your_module_name/static/src/fonts/YourCustomFont-Regular.woff2') format('woff2'),
url('/your_module_name/static/src/fonts/YourCustomFont-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}


Replace 'YourCustomFontName' with the actual name you want to use for your font, and adjust the paths in the url() statements to match the location of your font files within your module.

  1. include the font CSS file in the assets section:

"web.assets_frontend": [ "your_module_name/static/src/fonts/YourCustomFont-Regular.woff", "your_module_name/static/src/fonts/YourCustomFont-Regular.woff2", "your_module_name/static/src/css/custom_fonts.css" ], "web.assets_qweb": [ "your_module_name/static/src/fonts/YourCustomFont-Regular.woff", "your_module_name/static/src/fonts/YourCustomFont-Regular.woff2", "your_module_name/static/src/css/custom_fonts.css" ]

  1. Restart your Odoo server and update the module: After restarting the server, update your module to load the new assets.

  2. Customize the website theme: Go to the Odoo backend and navigate to Website > Configuration > Website Settings. In the "Options" tab, you should now see your custom font in the font family options. Select your custom font to apply it to the website theme.


アバター
破棄
最善の回答

Hello Mishaghmi,

You can give a path of your font folder in css.

.test {

        @font-face {

        font-family: 'myfont';

        src: url('/theme_test/static/src/fonts/230163575-DINNextLTArabic-Regular.eot');

        src: url('/theme_test/static/src/fonts/230163575-DINNextLTArabic-Regular.eot?#iefix') format('embedded-opentype'),

        url('/theme_test/static/src/fonts/230163575-DINNextLTArabic-Regular.woff') format('woff'),

        url('/theme_test/static/src/fonts/230163575-DINNextLTArabic-Regular.ttf') format('truetype'),

        url('/theme_test/static/src/fontss/230163575-DINNextLTArabic-Regular.svg#DIN Next LT Arabic') format('svg');

        font-weight: normal;

        font-style: normal;

        }

            li {

                font-family: 'myfont';

                }

}

Thank you!

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

アバター
破棄
最善の回答

Thanks für your solution Jainesh! Stupid Question, how do I access the odoo file system? I do not use odoo on premise, I use the cloud installation. Could you please briefly describe how I can access the files - i.e. how I can access the font folder in css? Thanks and br Horst

アバター
破棄
最善の回答

Hi,Please refer to this blog to understand how to add custom fonts to the theme.
https://www.cybrosys.com/blog/how-to-add-new-fonts-to-the-odoo-15-website

Even though it says about how to add custom fonts in version 15, 14 also follows the same steps.

Hope it helps

アバター
破棄

How about fopr odoo 16? The same?

関連投稿 返信 ビュー 活動
1
5月 24
3139
1
4月 24
26734
1
11月 22
2594
2
7月 22
3292
2
7月 22
3115