@@ -92,6 +92,11 @@ public class TextLayer : BaseLayer<TextLayer>
9292 /// </summary>
9393 protected string m_text ;
9494
95+ /// <summary>
96+ /// The text style to generate an image for.
97+ /// </summary>
98+ protected object m_textStyle ;
99+
95100 /// <summary>
96101 /// Required name of the font family. e.g. "arial".
97102 /// </summary>
@@ -209,6 +214,30 @@ public TextLayer Text(string text)
209214 return this ;
210215 }
211216
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+
212241 /// <summary>
213242 /// Type of font antialiasing to use.
214243 /// </summary>
@@ -396,6 +425,12 @@ private string OverlayTextEncode(string text)
396425
397426 private string TextStyleIdentifier ( )
398427 {
428+ var ts = m_textStyle ? . ToString ( ) ;
429+ if ( ! string . IsNullOrEmpty ( ts ) )
430+ {
431+ return ts ;
432+ }
433+
399434 List < string > components = new List < string > ( ) ;
400435
401436 if ( ! string . IsNullOrEmpty ( m_fontWeight ) && ! m_fontWeight . Equals ( "normal" , StringComparison . Ordinal ) )
0 commit comments