vijithassar/d3-textwrap

Build in font formatting

Opened this issue · 0 comments

When I call textwrap, any attributes I've assigned to the text (color, font, size, etc) are removed from said text. As far as I can tell, there's currently no way to pass attributes directly through the textwrap module to assign them as attributes of the foreignObject. My current solution is to run something like the following after creating the text with the call:

svg.select("foreignObject") .attr("color", "blue") .attr('font-size', 30) ;

This is okay, sort of, but it introduces additional blocks that need to be navigated, e.g., either ensuring that textwrap is the first foreignObject selected or putting all textwraps in their own groups before assigning attributes.

It seems like it would make more sense to build the assigning of text attributes into textwrap itself, instead. I'm happy to take a crack at it, if it makes sense to, but I wanted to open an issue first in case there are reasons it doesn't make sense as a solution or it's better handled by the repo owner.