@@ -55,15 +55,18 @@ new function() {
5555 }
5656
5757 // Converts a string attribute value to the specified type
58- function convertValue ( value , type ) {
58+ function convertValue ( value , type , lookup ) {
5959 return value === 'none'
6060 ? null
6161 : type === 'number'
6262 ? parseFloat ( value )
6363 : type === 'array'
6464 ? value ? value . split ( / [ \s , ] + / g) . map ( parseFloat ) : [ ]
65- : type === 'color' && getDefinition ( value )
66- || value ;
65+ : type === 'color'
66+ ? getDefinition ( value ) || value
67+ : type === 'lookup'
68+ ? lookup [ value ]
69+ : value ;
6770 }
6871
6972 // Importer functions for various SVG node types
@@ -336,7 +339,8 @@ new function() {
336339 // can affect gradient fills.
337340 var attributes = Base . merge ( Base . each ( SVGStyles , function ( entry ) {
338341 this [ entry . attribute ] = function ( item , value , name , node ) {
339- item . _style [ entry . set ] ( convertValue ( value , entry . type ) ) ;
342+ item . _style [ entry . set ] (
343+ convertValue ( value , entry . type , entry . fromSVG ) ) ;
340344 } ;
341345 } , { } ) , {
342346 id : function ( item , value ) {
@@ -375,19 +379,6 @@ new function() {
375379 item . setFont ( value . split ( ',' ) [ 0 ] . replace ( / ^ \s + | \s + $ / g, '' ) ) ;
376380 } ,
377381
378- 'font-size' : function ( item , value ) {
379- item . setFontSize ( parseFloat ( value ) ) ;
380- } ,
381-
382- 'text-anchor' : function ( item , value ) {
383- // http://www.w3.org/TR/SVG/text.html#TextAnchorProperty
384- item . setJustification ( {
385- start : 'left' ,
386- middle : 'center' ,
387- end : 'right'
388- } [ value ] ) ;
389- } ,
390-
391382 visibility : function ( item , value ) {
392383 item . setVisible ( value === 'visible' ) ;
393384 } ,
0 commit comments