3 ms·
I've encountered the problems you're trying to solve. First, it needs to handle word wrapping which yours doesn't seem to do. After that, it's i18n text that ma
by ryanackley 12y ago
I've encountered the problems you're trying to solve. First, it needs to handle word wrapping which yours doesn't seem to do. After that, it's i18n text that make this a difficult problem to solve. Specifically, RTL languages and CJK.
- moron4hire 12y agoRelease early, release often--or, we'll cross that bridge if we ever get to it. Unfortunately, I'm not out to make a tool for everyone in the world. No, I don't have a plan for those issues, but I and at least one other person I know have need for text editing in a WebGL context (specifically, with WebVR work). For that, I need a canvas element that I can make into a texture. The only previous work towards such a thing I could find was a Kickstarter that failed to deliver (https://www.kickstarter.com/projects/1241383920/open-source-programmers-text-editor-using-canvas-a/description https://www.kickstarter.com/projects/1241383920/open-source-...). The current status is that there is no way for any locale to have even antiquated ASCII text, highlighted, and working with editor controls, in a WebGL context.
- ryanackley 12y agoI understand. By your problem statement, I thought you were more interested in replacing content editable or a text area. An editor that adds text to canvas with manual line breaking has been done plenty of times before.
- mattdesl 12y agoText in WebGL is still really immature. I've done a bit of tinkering with a variety of modules for word-wrapping, etc. None of them are "fully featured" or 100% stable but I have used them in a couple of production environments. https://github.com/mattdesl/fontpath https://github.com/mattdesl/fontpath The WebGL module on top of that: https://github.com/mattdesl/gl-sprite-text https://github.com/mattdesl/gl-sprite-text The main issue I have with most text libraries (like TxtJS) is that they assume 2D canvas, or trivial WebGL applications. The bulk of the text code really just deals with laying out rectangular glyphs; the rendering (whether geometry, bitmaps, SDF, etc) should be separate so the dev can choose the best technique for their app. An example of SDF / fontpath in action: http://mattdesl.github.io/xmas http://mattdesl.github.io/xmas