@@ -159,8 +159,6 @@ var LAYER_KEYWORD_PARAMS = {
159159} ;
160160
161161function textStyle ( layer ) {
162- var font_family = layer . font_family ;
163- var font_size = layer . font_size ;
164162 var keywords = [ ] ;
165163 var style = "" ;
166164 Object . keys ( LAYER_KEYWORD_PARAMS ) . forEach ( function ( attr ) {
@@ -170,23 +168,24 @@ function textStyle(layer) {
170168 keywords . push ( attr_value ) ;
171169 }
172170 } ) ;
173- var letter_spacing = layer . letter_spacing ;
174- if ( letter_spacing ) {
175- keywords . push ( `letter_spacing_${ letter_spacing } ` ) ;
176- }
177- var line_spacing = layer . line_spacing ;
178- if ( line_spacing ) {
179- keywords . push ( `line_spacing_${ line_spacing } ` ) ;
180- }
181- if ( font_size || font_family || ! isEmpty ( keywords ) ) {
182- if ( ! font_family ) {
183- throw "Must supply font_family for text in overlay/underlay" ;
171+
172+ Object . keys ( layer ) . forEach ( function ( attr ) {
173+ if ( attr === "letter_spacing" || attr === "line_spacing" ) {
174+ keywords . push ( `${ attr } _${ layer [ attr ] } ` ) ;
184175 }
185- if ( ! font_size ) {
186- throw "Must supply font_size for text in overlay/underlay" ;
176+ if ( attr === "font_hinting" ) {
177+ keywords . push ( ` ${ attr . split ( "_" ) . pop ( ) } _ ${ layer [ attr ] } ` ) ;
187178 }
188- keywords . unshift ( font_size ) ;
189- keywords . unshift ( font_family ) ;
179+ if ( attr === "font_antialiasing" ) {
180+ keywords . push ( `antialias_${ layer [ attr ] } ` ) ;
181+ }
182+ } ) ;
183+
184+ if ( layer . hasOwnProperty ( "font_size" || "font_family" ) || ! isEmpty ( keywords ) ) {
185+ if ( ! layer . font_size ) throw `Must supply font_size for text in overlay/underlay` ;
186+ if ( ! layer . font_family ) throw `Must supply font_family for text in overlay/underlay` ;
187+ keywords . unshift ( layer . font_size ) ;
188+ keywords . unshift ( layer . font_family ) ;
190189 style = compact ( keywords ) . join ( "_" ) ;
191190 }
192191 return style ;
@@ -1502,4 +1501,4 @@ exports.build_streaming_profiles_param = build_streaming_profiles_param;
15021501exports . hashToParameters = hashToParameters ;
15031502exports . present = present ;
15041503exports . only = only ;
1505- exports . jsonArrayParam = jsonArrayParam ;
1504+ exports . jsonArrayParam = jsonArrayParam ;
0 commit comments