我正在研究 keycloak 登录页面的主题定制,但我在登录页面添加自定义字体时遇到了困难。我不知道如何正确引用它。我将其添加到 login.ftl 页面的样式标记中。非常感谢任何形式的帮助
@font-face {
font-family: "Stroke-Weight-Two"!important;
src: url("../fonts/strokeWeight-080rotateR06.ttf") format("truetype");
}
@font-face {
font-family: "Stroke-Weight-One"!important;
src: url("../fonts/strokeWeight-080.ttf") format("truetype");
}
我通过这种方式直接添加到html中解决了这个问题。希望它也对您有帮助。请不要忘记根据您的文件夹结构更新路径。
将此部分添加到 template.ftl head 部分。
<style>
@font-face {
font-family: 'TT Interphases';
src: url('${url.resourcesPath}/fonts/tt_interphases_pro/TT Interphases Pro Mono Trial Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
</style>