如何使用 httpclient 作为二进制文件在 angular 中加载字体文件(ttf 和 otf)以使用 opentype.js 进行处理

How to load a font file( ttf and otf) in angular using httpclient as binary file to process with opentype.js

如何使用 httpclient 作为二进制文件在 angular 中加载字体文件(ttf 和 otf)以使用 opentype.js 进行处理。我必须从使用 angular http 模块加载的字体文件中提取 svg 路径。我应该在服务中为数组缓冲区等文件提及什么类型

在 GET 请求中设置适当的 responseTypehttps://angular.io/api/common/http/HttpRequest#responseType

this._http
    .get(url, { responseType: 'blob' }) // or 'arraybuffer'
    .subscribe(
        res => {
            // pass reaponse to opentype.js
        }
    );