highcharts / highcharts/node-export-server

Google Font Barlow Semi Condensed not rendering in chart

Open
#489 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
369
Forks
266
PR merge metrics
No merged PRs in 30d

Description

Hello,
I would like to report a bug concerning the use of a Google font not being taken into account.
I wanted to use the [Barlow Semi Condensed font](https://fonts.google.com/specimen/Barlow+Semi+Condensed) and apply it to the generated graphics.
However, the font is not taken into account, despite the fact that I followed the librarian's README recommendations.
Please note that I'm running the server on Windows 10 with Node version 18.17.1
Thank you in advance for your help.

#### Expected behaviour
Generating a graphic with the Barlow Semi Condensed font

#### Actual behaviour
Generate a graphic in Highchart's default Helvetica font

#### Reproduction steps

##### Install with the following command
npm i highcharts-export-server@3.1.1

##### Install google font and copy font .ttf to C:\Windows\Fonts\
copy yourFont.ttf C:\Windows\Fonts\yourFont.ttf

##### Create custom script server.js
```js
const exporter = require("highcharts-export-server");

const start = async () => {
const options = exporter.setOptions({
"highcharts": {
"version": "11.1.0"
},
"export": {
"type": "svg",
"constr": "chart",
"height": 1125,
"width": 1500,
"globalOptions": {
style: {
"fontFamily": "Barlow Semi Condensed, sans-serif",
"fontSize":"1rem"
}
}
}
});

await exporter.initPool(options);

await exporter.startServer({
"enable": true,
"host": "127.0.0.1",
"port": 7801,
"ssl": {
"enable": false,
"force": false,
"port": 443,
"certPath": ""
},
"rateLimiting": {
"enable": false,
"maxRequests": 50,
"skipKey": "",
"skipToken": ""
}
});
};

start();
```

##### Run custom script
node server.js

##### Do a cURL request on the current HTTP server
```
curl --location 'http://127.0.0.1:7801' \
--header 'Content-Type: application/json' \
--data '{
"infile": {
"title": {
"text": "Steep Chart"
},
"xAxis": {
"categories": [
"Jan",
"Feb",
"Mar"
]
},
"series": [
{
"data": [
29.9,
71.5,
106.4
]
}
]
}
}'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.