@@ -92,6 +92,11 @@ public class TextLayer : BaseLayer<TextLayer>
92
92
/// </summary>
93
93
protected string m_text ;
94
94
95
+ /// <summary>
96
+ /// The text style to generate an image for.
97
+ /// </summary>
98
+ protected object m_textStyle ;
99
+
95
100
/// <summary>
96
101
/// Required name of the font family. e.g. "arial".
97
102
/// </summary>
@@ -209,6 +214,30 @@ public TextLayer Text(string text)
209
214
return this ;
210
215
}
211
216
217
+ /// <summary>
218
+ /// Sets a text style identifier.
219
+ /// Note: If this is used, all other style attributes are ignored in favor of this identifier.
220
+ /// </summary>
221
+ /// <param name="textStyleIdentifier">A variable string or an explicit style (e.g. "Arial_17_bold_antialias_best").</param>
222
+ /// <returns>The layer with text style applied.</returns>
223
+ public TextLayer TextStyle ( string textStyleIdentifier )
224
+ {
225
+ this . m_textStyle = textStyleIdentifier ;
226
+ return this ;
227
+ }
228
+
229
+ /// <summary>
230
+ /// Sets a text style identifier.
231
+ /// Note: If this is used, all other style attributes are ignored in favor of this identifier.
232
+ /// </summary>
233
+ /// <param name="textStyleIdentifier">An expression instance referencing the style..</param>
234
+ /// <returns>The layer with text style applied.</returns>
235
+ public TextLayer TextStyle ( Expression textStyleIdentifier )
236
+ {
237
+ this . m_textStyle = textStyleIdentifier ;
238
+ return this ;
239
+ }
240
+
212
241
/// <summary>
213
242
/// Type of font antialiasing to use.
214
243
/// </summary>
@@ -396,6 +425,12 @@ private string OverlayTextEncode(string text)
396
425
397
426
private string TextStyleIdentifier ( )
398
427
{
428
+ var ts = m_textStyle ? . ToString ( ) ;
429
+ if ( ! string . IsNullOrEmpty ( ts ) )
430
+ {
431
+ return ts ;
432
+ }
433
+
399
434
List < string > components = new List < string > ( ) ;
400
435
401
436
if ( ! string . IsNullOrEmpty ( m_fontWeight ) && ! m_fontWeight . Equals ( "normal" , StringComparison . Ordinal ) )
0 commit comments