Closed Apidcloud closed 5 years ago
Also opened an issue on canvas-prebuilt itself: https://github.com/node-gfx/node-canvas-prebuilt/issues/30
I'll try to build it targeting node 7.9 and use it in this package.
Edit: no luck thus far.
Haven't tried this on electron yet. Maybe it relates to path canvas-prebuild loading local dynamic libraries. Why not search a solution in electron community?
msdf-bmfont-xml
is designed as a back-end program. If you decide to use it as front-end, it's better to substitute node-canvas
to DOM canvas or WebGL framework like Pixi.js. They are used to render glyphs to final atlas, nothing more.
I think it’s because electron uses a different node version within (1.7.11 uses 7.9), so node canvas has to be built targeting that version instead. I’ve opened an issue in that repository as well, to check whether that’s possible. I’ll keep you updated :) thanks!
Good news! It does seem to work under electron when targeting it (e.g., 1.7.11). See https://github.com/node-gfx/node-canvas-prebuilt/issues/30 for the discussion.
If the author is able to release a version with said target, could you do the same?
For now, I rebuilt node-canvas-prebuilt inside a clone of this package (in its node_modules), and then linked it to a project that consumes it under electron.
Thanks! 💯
Good to hear that! Let me know the news from canvas-prebuilt
and I'll update accordingly.
BTW: I'm planning to replace node-canvas
and opentype.js
to some more light-weighted dependencies in the near future.
Thanks!
Still got no news from canvas-prebuilt
, but I'm curious about replacing those libraries. Anything in mind yet?
Edit: I know https://github.com/nascherman/opentype-bmfont (see https://github.com/nascherman/opentype-bmfont/issues/4 though) but it still uses opentype.js
under the hood. The generation is accomplished through text-to-svg
and svg-to-image
.
Haven't got time on this yet, but my plan is replace node-canvas
with node-pngjs
on back-end, or pixi.js
on front-end. opentype.js
to more light-weight typr.js
on runtime-parser or fontkit
maybe.
Still no answer from canvas-prebuilt
. Can we release an electron version ourselves for the time being?
@Apidcloud Recent update replaced canvas-prebuilt
with jimp
, let me know if this update has any luck solving your problem.
Meanwhile I got it working by publishing my own builds of canvas
.
But using jimp
seems simpler. I will try to test it soon!
Edit: Seems to work 💯 I had no problems with the new version!
It showed the following, though (I guess it makes sense):
Use font-face as filename : arialbd
Generating 0%|░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░| (0/95) 0s
Warning: no bitmap for character ' ' (32), adding to font as empty
Generation complete!
Ah. Still regarding that message, the bar doesn't really go further (from 0% to 100%) despite actually working.
Ah, that's absolutely normal. space
does not have any glyph so a blank bitmap warning is given. The progress bar just shows that the warning is triggered at 0/95. Just ignore it.
Fixed the progress bar info above warning message via fa5e9a90755e20762b96d75995a4f07a54b96a73
Since it's minor fix, will merge to master
in next release.
Good evening!
I have no problems using this package from node, but I wonder if there a good way to make this run from electron?
The following error is raised when I attempt to do so: Uncaught Error: A dynamic link library (DLL) initialization routine failed.
I tried to run electron-rebuild on it, but it still happens. I wonder if I would need a specific build from canvas-prebuilt. Any ideas?