相关疑难解决方法(0)

如何将新字体导入项目 - Angular 5

我想将一个新字体导入我的Angular 5项目.

我试过了:

1)将文件复制到assets/fonts /

2)将其添加到.angular-cli.json样式中

但我已经检查过该文件不是a .css,它是一个.otf.exe(它是一个安装程序)的工具,所以我真的不知道如何导入它.任何的想法?

fonts angular

33
推荐指数
3
解决办法
6万
查看次数

注册字体正在破坏.TTF文件

在我的系统上,我需要注册两个外部字体.TTF文件:

HamletOrNot.ttf (74 KB)
MorrisRoman-Black.ttf (67 KB)
Run Code Online (Sandbox Code Playgroud)

在创建Font()对象之前,我使用以下命令进行记录:

/* Set full path of font */
String path = filesPath + fileName;

/* Read file */
Resource resource = applicationContext.getResource( path );
File fontFile = resource.getFile();

/* Load font */
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, fontFile ));
Run Code Online (Sandbox Code Playgroud)

然后我创建了对象(我创建了多个Font()因为格式不同):

Font font = new Font( "HamletOrNot" , Font.TRUETYPE_FONT , 10 );
Font font = new Font( "HamletOrNot" , Font.TRUETYPE_FONT , 12 );
Font font = new Font( "MorrisRoman-Black" , Font.TRUETYPE_FONT , 20 ); …
Run Code Online (Sandbox Code Playgroud)

java truetype

6
推荐指数
1
解决办法
3276
查看次数

标签 统计

angular ×1

fonts ×1

java ×1

truetype ×1