[API] Allow canvas font customisation (#987)

Allows customisation of fonts via `LiteGraph` global var:

```ts
LiteGraph.NODE_FONT = "wingdings"
```


![image](https://github.com/user-attachments/assets/36bec38d-ea5f-4ec6-a2a3-bc5a57826c1e)
This commit is contained in:
filtered
2025-05-01 10:19:36 +10:00
committed by GitHub
parent c695b2e2bd
commit 0cdee75460
5 changed files with 14 additions and 6 deletions

View File

@@ -198,11 +198,11 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
* The font style used to render the node's title text.
*/
get titleFontStyle(): string {
return `${LiteGraph.NODE_TEXT_SIZE}px Arial`
return `${LiteGraph.NODE_TEXT_SIZE}px ${LiteGraph.NODE_FONT}`
}
get innerFontStyle(): string {
return `normal ${LiteGraph.NODE_SUBTEXT_SIZE}px Arial`
return `normal ${LiteGraph.NODE_SUBTEXT_SIZE}px ${LiteGraph.NODE_FONT}`
}
graph: LGraph | null = null