News for hackers. Stuff that matters.
Re:Show HN: Primrose – A text editor that draws to Canvas by moron4hire on Saturday January 03, 2015 @09:04PM (#8832878)
Release 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-...). 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.

Re:Show HN: Primrose – A text editor that draws to Canvas by mattdesl on Wednesday January 07, 2015 @10:31AM (#8850998)
Text 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

The WebGL module on top of that:

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

Re:Show HN: Primrose – A text editor that draws to Canvas by ryanackley on Saturday January 03, 2015 @09:46PM (#8832965)
I 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.