Live data from Hacker News

Txt – A canvas font and typesetting engine

txtjs.com

11–20 of 21 posts

Re: Txt – A canvas font and typesetting engine

#12
post #3

I'd love a library for SVGText that allowed me to adjust kerning, character effects, and layout in the same way.

I agree. Txt adds SVGPath support to and is how we render glyphs, SVG support would be a great addition to txtjs and many classes would not need to change at all. Rather than render to Canvas, it would subclass SVGElement.

Re: Txt – A canvas font and typesetting engine

#14

I wrote txtjs. Free to ask away.

How many times did you want to claw your eyes out when writing this? :-)

There were moments in alignment support where I lost a ton of hair and brain cells. The hardest part was getting W3C compliant rendering of SVGPath on , after that it was all downhill.

Txt is live in use on:

expressionery.com walmartstationery.com iprint.com

Re: Txt – A canvas font and typesetting engine

#15

I wrote txtjs. Free to ask away.

Have to ask: a dive trip, of all places?

I wrote the beginnings of txtjs on a trip to Bonaire in June. I find I am about 2x-3x as productive writing software during surface intervals while diving than any other time. The diving forces you to relax, think, breath, and you cannot use a computer. When the dive is over, you are 3x productive and things are easier to implement. Also I dive with Nitrox with adds 10% more O2 into the tank, I end up sleeping better, less risk of n2 narcosis, longer bottom times, and I can think very clearly after a dive.

It sounds absurd but I have found I will hit flow more on dive trips than any other time.

Get certified: padi.com

Re: Txt – A canvas font and typesetting engine

#16
Any plans to integrate soft hyphenation out of the box? This makes block layouts look so much nicer.

https://code.google.com/p/hyphenator/

https://github.com/bramstein/hypher

Also this tool shouldn't obfuscate the text content if not explicitly wanted, which in the days of captcha reading OCRs is a desperate measure anyways and doesn't add to the accessibility of the page. Please add the rendered text in the alt attribute of the canvas by default. Or even better make it degrade gracefully to proper HTML by using some CSS replacement technique linking to the dataURL of the dynamically created off-screen canvas image.

See HTMLCanvasElement.toDataURL()

Re: Txt – A canvas font and typesetting engine

#17
post #3

I'd love a library for SVGText that allowed me to adjust kerning, character effects, and layout in the same way.

I agree. Txt adds SVGPath support to and is how we render glyphs, SVG support would be a great addition to txtjs and many classes would not need to change at all. Rather than render to Canvas, it would subclass SVGElement.

Hmm, I'll take a look through the repo, thanks for the pointers!

Re: Txt – A canvas font and typesetting engine

#18

Earlier quoted context omitted.

Have to ask: a dive trip, of all places?

I wrote the beginnings of txtjs on a trip to Bonaire in June. I find I am about 2x-3x as productive writing software during surface intervals while diving than any other time. The diving forces you to relax, think, breath, and you cannot use a computer. When the dive is over, you are 3x productive and things are easier to implement. Also I dive with Nitrox with adds 10% more O2 into the tank, I end up sleeping better…

I am, although NAUI. Diving leaves me surprisingly sleepy and unmotivated (I don't do any blended air stuff). The idea of cranking out a typesetting engine on a dive boat was a new one. :)

Re: Txt – A canvas font and typesetting engine

#20
post #19

I wonder how they compute their text dimensions. Anybody else noticed how slow the canvas measureText() function is on Chrome?

Fonts arrive with a units specified, typically 1000 and with values for ascent/decent/xHeight/more.... This provides the basis for font sizing and kerning. In txt we know the relative sizes detailed in the font and we know each character size. This level of detail is unknown to the canvas API today, text is a black box returning images of characters. Also glyphs are drawn inverted along the true baseline so layout is very accurate in dealing with lineHeight and vertical positioning.
Post reply on HN