Hacker News new | past | comments | ask | show | jobs | submit login

> couldn't you create all the elements in parallel and collect them at the end?

Determining the bounding box of SVG text is not easy even with a monospace font since you're at the mercy of the final rendering system as to which font is actually used and how the metrics are processed. It is safer to do each line as a <text> element with colors added by <tspan> segments inside. That guarantees you only have to align the left edge at the same X coordinate. You could also do multi-line text in a single <text> element but that isn't guaranteed to work in SVG 1.1.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: