diff --git a/src/main.js b/src/main.js index 5274388..90efd54 100644 --- a/src/main.js +++ b/src/main.js @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +import { getAssetsUrl } from './config/env'; import { createApp } from 'vue' import { createPinia } from 'pinia'; import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'; @@ -25,10 +26,29 @@ import './styles/common.css' import './styles/variables/colors.css' import './styles/variables/dimensions.css'; +import rawFonts from './styles/fonts.json'; import './styles/common.css'; import './styles/variables/colors.css'; (async () => { + const fonts = rawFonts.map((font) => new FontFace( + font.family ?? '', + Array.isArray(font.source) + ? font.source.map( + (source) => `url('${source.url + ? new URL(source.url, getAssetsUrl()).href + : '' + }') format('${source.format ?? ''}')` + ).join(',') + : '', + { + weight: font.weight ?? undefined, + style: font.style ?? undefined + } + )); + await Promise.all(fonts.map((font) => font.load())); + fonts.forEach((font) => document.fonts.add(font)); + await loadLanguage(fallbackLocale); await loadLanguage(getCurrentLanguage()); diff --git a/src/styles/fonts.json b/src/styles/fonts.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/src/styles/fonts.json @@ -0,0 +1 @@ +[]