Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
1600 Tampilan

Greetings everyone,

I'm interested in modifying the font (add custom language fonts) and color of menu items on the default theme. 

I've checked Edit -> Customize, but there doesn't seem to be an option for it. 


I found some articles and forum posts referring the changes on server side.
https://www.cybrosys.com/blog/how-to-add-custom-fonts-in-odoo-16
However, i could not found anu  static/src/font/ directory in theme_default

Could you please provide guidance on how to achieve this? 

Thanks in advance!

Avatar
Buang
Jawaban Terbai

Hey Dimitri,


I hope you are doing well.


For adding fonts in default theme, we need to follow the steps defined below:


1. Download and Add fonts file under static > src > fonts folder.

2. Please find code in comment. 

3. Define the scss file in your manifest.

I hope this will help you. 

Thanks & Regards,
Email:   odoo@aktivsoftware.com      

Skype: kalpeshmaheshwari

Avatar
Buang

Please find code here :-

2. Add primary_variable.scss file under static > src > scss. Add the below defined scss.
@font-face {
font-family: 'HoneyBlackDEMO';
src: url('/your_module_name/static/src/fonts/HoneyBlackDEMO.otf') format('truetype');
}

$o-theme-font-configs: (
'Roboto': (
'family': ('Roboto', sans-serif),
'url': 'Roboto:300,300i,400,400i,700,700i',
),
'Open Sans': (
'family': ('Open Sans', sans-serif),
'url': 'Open+Sans:300,300i,400,400i,700,700i',
),
'Source Sans Pro': (
'family': ('Source Sans Pro', sans-serif),
'url': 'Source+Sans+Pro:300,300i,400,400i,700,700i',
),
'Raleway': (
'family': ('Raleway', sans-serif),
'url': 'Raleway:300,300i,400,400i,700,700i',
),
'Noto Serif': (
'family': ('Noto Serif', serif),
'url': 'Noto+Serif:300,300i,400,400i,700,700i',
),
'Arvo': (
'family': ('Arvo', Times, serif),
'url': 'Arvo:300,300i,400,400i,700,700i',
),
'HoneyBlackDEMO': (
'family': ('HoneyBlackDEMO'),
),
) !default;

Penulis Jawaban Terbai

Hi Janesh,

Thanks for your reply. I followed the recommended steps.

Inside addons/theme_default/static directory i have created new directories src, under it fonts and scss directories.

Then i have uploaded fonts inside fonts directory and accordingly updated primary_variable.scss file 

@font-face {

    font-family: 'ALK Sanet';

    src: url('/theme_default/static/src/fonts/alk-sanet-webfont.eot'); /* IE9 Compat Modes */

    src: url('/theme_default/static/src/fonts/alk-sanet-webfont.eot?#iefix') format('embedded-opent>

         url('/theme_default/static/src/fonts/alk-sanet-webfont.woff2') format('woff2'), /* Super M>

         url('/theme_default/static/src/fonts/alk-sanet-webfont.woff') format('woff'), /* Pretty Mo>

         url('/theme_default/static/src/fonts/alk-sanet-webfont.ttf') format('truetype'), /* Safari>

         url('/theme_default/static/src/fonts/alk-sanet-webfont.svg#alk_sanetregular') format('svg'>

}


and accordingly __manifest__.py file in theme_default root folder:

'depends': ['website'],

    'assets':{

        'web._assets_primary_variables':[

            'theme_default/static/src/scss/primary_variable.scss',

         ],

    },

However, unfortunately I don't see new fonts in the list:

Anything else i can change to add new fonts?

Thanks

Avatar
Buang

Hey Dimitri,

I hope you are doing well.

Add the defined scss.

$o-theme-font-configs: (
'Roboto': (
'family': ('Roboto', sans-serif),
'url': 'Roboto:300,300i,400,400i,700,700i',
),
'Open Sans': (
'family': ('Open Sans', sans-serif),
'url': 'Open+Sans:300,300i,400,400i,700,700i',
),
'Source Sans Pro': (
'family': ('Source Sans Pro', sans-serif),
'url': 'Source+Sans+Pro:300,300i,400,400i,700,700i',
),
'Raleway': (
'family': ('Raleway', sans-serif),
'url': 'Raleway:300,300i,400,400i,700,700i',
),
'Noto Serif': (
'family': ('Noto Serif', serif),
'url': 'Noto+Serif:300,300i,400,400i,700,700i',
),
'Arvo': (
'family': ('Arvo', Times, serif),
'url': 'Arvo:300,300i,400,400i,700,700i',
),
'ALK Sanet': (
'family': ('ALK Sanet'),
),
) !default;

Thanks & regards

Post Terkait Replies Tampilan Aktivitas
0
Des 24
393
4
Okt 19
32502
1
Apr 17
3201
2
Jan 24
13122
2
Mar 15
6523