如何导入和更改moodle的boost字体

问题描述 投票:0回答:1

我正在尝试更改我的字体,以便它影响我的整个心情。

字体来自 bootstrap 的 scss 文件。

我见过这个问题,但是使用它不起作用。

我也看过这个SO问题moodle指南,但这对我来说也不起作用。

我正在使用 Moodle 4.15

这是我当前的代码:

// Body
//
// 1. Remove the margin in all browsers.
// 2. As a best practice, apply a default `background-color`.
// 3. Set an explicit initial text-align value so that we can later use
//    the `inherit` value on things like `<th>` elements.

@font-face {
  font-family: 'RoCo';
  src: url('/theme/boost/font/RobotoCondensed-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

body {
  margin: 0; // 1
  font-family: 'Roco';
  @include font-size($font-size-base);
  font-weight: $font-weight-base;
  line-height: $line-height-base;
  color: $body-color;
  text-align: left; // 3
  background-color: $body-bg; // 2
}

当页面尝试加载时,我收到此错误:

我的路径确实是正确的,因为跟随链接重定向到该文件。

我做错了什么,还是这根本不是改变字体的方法?

编辑:忘了告诉,但是这段代码引用了 '/theme/boost/scss/bootstrap/_reboot.scss' 中的 _reboot.scss 文件

sass moodle
1个回答
0
投票

最有效、最干净的方法是创建一个 boost 子主题: https://docs.moodle.org/dev/Creating_a_theme_based_on_boost https://docs.moodle.org/402/en/How_to_add_custom_fonts_in_a_theme

强加字体的一种残酷方法是使用此规则(在 scss 中):

body{
    *{
        font-family: 'FontName' !important;
        src: url([[font:theme|fontname.eot]]) !important;
        src: url([[font:theme|fontname.eot]]) format('embedded-opentype'),
        url([[font:theme|fontname.woff]]) format('woff'),
        url([[font:theme|fontname.woff2]]) format('woff2'),
        url([[font:theme|fontname.ttf]]) format('truetype'),
        url([[font:theme|fontname.svg]]) format('svg');
        font-weight: normal !important;
        font-style: normal !important;
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.