Skip to content

Conversation

@jkub6
Copy link

@jkub6 jkub6 commented Oct 28, 2025

I have been using d2 to create diagrams in my revealjs presentations, which are embedded as svg files. The svg files have embedded fonts with the same name, but different glyphs. This has been causing issues when attempting to merge the fonts.

Error: Repeat unicode, glyph index: 9
    at Object.raise (/nix/store/0l2sgyrb6ggd4nv5balc2svq8g83dry4-decktape/lib/node_modules/decktape/node_modules/fonteditor-core/lib/ttf/error.js:45:17)
    at /nix/store/0l2sgyrb6ggd4nv5balc2svq8g83dry4-decktape/lib/node_modules/decktape/node_modules/fonteditor-core/lib/ttf/ttfwriter.js:78:33
    at Array.forEach (<anonymous>)
    at /nix/store/0l2sgyrb6ggd4nv5balc2svq8g83dry4-decktape/lib/node_modules/decktape/node_modules/fonteditor-core/lib/ttf/ttfwriter.js:76:24
    at Array.forEach (<anonymous>)
    at TTFWriter.resolveTTF (/nix/store/0l2sgyrb6ggd4nv5balc2svq8g83dry4-decktape/lib/node_modules/decktape/node_modules/fonteditor-core/lib/ttf/ttfwriter.js:73:16)
    at TTFWriter.write (/nix/store/0l2sgyrb6ggd4nv5balc2svq8g83dry4-decktape/lib/node_modules/decktape/node_modules/fonteditor-core/lib/ttf/ttfwriter.js:221:12)
    at Font.write (/nix/store/0l2sgyrb6ggd4nv5balc2svq8g83dry4-decktape/lib/node_modules/decktape/node_modules/fonteditor-core/lib/ttf/font.js:156:53)
    at file:///nix/store/0l2sgyrb6ggd4nv5balc2svq8g83dry4-decktape/lib/node_modules/decktape/decktape.js:402:58
    at Array.forEach (<anonymous>) {
  number: 10200,
  data: 9
}

This change will hash each font and only attempt to merge them if the fonts are identical (hashes match). This fully resolves the problem for me.

@astefanutti
Copy link
Owner

@jkub6 thanks a lot for opening this up.
Would you be able to share your presentation, I'd like to check whether it's not voiding the merging of the fonts as I suspect the SHA might become different for each slide.

@jkub6
Copy link
Author

jkub6 commented Oct 28, 2025

Here is a minimal self-contained example that exibits the error:
index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants