跳到內容

Apply Typeface

Apply Typeface 可作為 Style Behaviour 使用,以程序化方式動態設定在 Text Shape 中使用的字型。例如,將最後一個詞的字型設為 Times New Roman,或將字串中每次出現的 Cavalry 設為 Helvetica。

Font - 選擇字型和字重。

Mode - 選擇選取模式:

  • Regex - 設定一個正規表示式來決定字串的哪些部分被選取。在 Attribute Editor UI 頂部有幾個預設可用。
  • Specific Indices - 手動輸入索引來決定哪些行/詞/字元被選取。
  • All - 當與 Behaviour 一起使用 Apply Typeface 時使用此設定。參見 Create > Demo Scenes > Text > Variable Font

Index Mode - 當 Mode 設為 Specific Indices 時,選擇受影響的層級:

  • Line - 填充 Specific Indices 定義的每一行。
  • Word - 填充 Specific Indices 定義的每個詞。
  • Character - 填充 Specific Indices 定義的每個字元。

Specific Indices - 當 Mode 設為 Specific Indices 時,設定要選擇的索引。列表值使用逗號 , 分隔,範圍使用冒號 : 分隔。例如 0,1:3,8 將選擇索引 0、1、2、3 和 8。你也可以輸入 firstlast 來程序化選擇這些索引。注意空格字元也包括在索引中。

Regex - 輸入一個正規表示式。參見 Working with Regex 了解更多資訊。

Capture Group Indices - 當正規表示式包含捕獲群組時,決定傳回哪些群組。列表值使用逗號 , 分隔,範圍使用冒號 : 分隔。參見 Working with Regex 了解更多資訊。

  1. 建立一個 Text Shape
  2. 輸入字串 Here's to the crazy ones
  3. 點擊 Style Behaviours 屬性右側的 +
  4. 從列表中選擇 Apply Typeface
  5. 雙擊 Scene Window 中的 Apply Typeface 圖層,將其 UI 載入到 Attribute Editor。
  6. 設定一個 Font
  7. Regex 屬性中輸入字串 crazy

Text Shape 中單詞 crazy 將被設為步驟 6 中選擇的字型。