@@ -17,6 +17,7 @@ export class Text extends Mark {
1717 text = indexOf ,
1818 textAnchor,
1919 lineAnchor = "middle" ,
20+ lineHeight = 1 ,
2021 fontFamily,
2122 fontSize,
2223 fontStyle,
@@ -41,6 +42,7 @@ export class Text extends Mark {
4142 this . rotate = crotate ;
4243 this . textAnchor = impliedString ( textAnchor , "middle" ) ;
4344 this . lineAnchor = keyword ( lineAnchor , "lineAnchor" , [ "top" , "middle" , "bottom" ] ) ;
45+ this . lineHeight = + lineHeight ;
4446 this . fontFamily = string ( fontFamily ) ;
4547 this . fontSize = cfontSize ;
4648 this . fontStyle = string ( fontStyle ) ;
@@ -79,7 +81,7 @@ export class Text extends Mark {
7981 }
8082}
8183
82- function applyMultilineText ( selection , { lineAnchor} , T ) {
84+ function applyMultilineText ( selection , { lineAnchor, lineHeight } , T ) {
8385 if ( ! T ) return ;
8486 const format = isTemporal ( T ) ? isoFormat : isNumeric ( T ) ? formatNumber ( ) : string ;
8587 selection . each ( function ( i ) {
@@ -90,7 +92,7 @@ function applyMultilineText(selection, {lineAnchor}, T) {
9092 for ( let i = 0 ; i < n ; ++ i ) {
9193 const tspan = document . createElementNS ( namespaces . svg , "tspan" ) ;
9294 tspan . setAttribute ( "x" , 0 ) ;
93- tspan . setAttribute ( "y" , `${ y + i } em` ) ;
95+ tspan . setAttribute ( "y" , `${ y + i * lineHeight } em` ) ;
9496 tspan . textContent = lines [ i ] ;
9597 this . appendChild ( tspan ) ;
9698 }
0 commit comments