From 4532b67f3cb96b0b80f02bf9174e1f23da2fa8e8 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Fri, 11 Dec 2020 11:12:56 +0000 Subject: [PATCH] [IMP] website: support old fonts that have been renamed in theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes odoo/odoo#63382 X-original-commit: 49f3ee8ab4912c52f5e60b9392c5805272923064 Related: odoo/design-themes#431 Signed-off-by: Jérémy Kersten (jke) --- .../static/src/scss/secondary_variables.scss | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/scss/secondary_variables.scss b/addons/website/static/src/scss/secondary_variables.scss index 1f42a6155b4..53f8f9ed922 100644 --- a/addons/website/static/src/scss/secondary_variables.scss +++ b/addons/website/static/src/scss/secondary_variables.scss @@ -1,4 +1,3 @@ - //------------------------------------------------------------------------------ // Website customizations //------------------------------------------------------------------------------ @@ -24,12 +23,39 @@ $-first-font-name: nth(map-keys($o-theme-font-configs), 1); @return $values; } +// Some fonts have been renamed in a stable version, and for retro compatibility +// for users which have a custom user_values.css as attachment with an old font +// already used, we map the old font with the new `similar` font +$o-fonts-similar: ( + 'Droid Serif': 'Noto Serif', + 'SinKinSans': 'Spartan', + 'Proxima': 'Montserrat', + 'Comic Sans MS': 'Comic Neue', + 'Fontastique': 'Bubblegum Sans', + 'Luminari': 'Eagle Lake', + 'Fecske': 'Marcellus', + 'Din Alternate': 'Roboto', +); + +@function o-map-font-aliases($values) { + $-values: $values; + @each $key in map-values($o-font-aliases-to-keys) { + $value: map-get($values, $key); + @if ($value and map-has-key($o-fonts-similar, $value)) { + $-values: map-merge($-values, ( + $key: map-get($o-fonts-similar, $value), + )); + } + } + @return $-values; +}; + // By default, most website palette values are null. Each null value is // automatically replaced with corresponsing values in chosen default values // palette. $-website-values-default: o-safe-nth($o-website-values-palettes, $o-website-values-palette-number, ()); $-website-values-default: map-merge($o-base-website-values-palette, o-map-omit($-website-values-default)); -$o-user-website-values: o-map-omit($o-user-website-values); +$o-user-website-values: o-map-font-aliases(o-map-omit($o-user-website-values)); $-actual-user-website-values-palette: map-merge($-website-values-default, $o-user-website-values); // Default font selection + User font selection have been merged, now need to // add the right associated font default config