テキスト:文字 -2-
テキストレイヤーのスタイルを制御することもできます。
なおエクスプレッションで使用するフォントはプロジェクトの使用フォントとしては保存されません。
- テキストレイヤー>テキスト>プロパティ
- 使用していいるフォントを参照するにはエクスプレッションメニューのフォントドロップダウンメニューで選択します
テキスト・スタイル
メソッド | |
レイヤーのフォント名 | style = text.sourceText.style.font; |
別のレイヤーのフォント名 | thisComp.layer("source layer name").text.sourceText.style.font; |
レイヤーのフォントサイズ | text.sourceText.style.fontSize; |
レイヤーのテキストが太字かどうか | text.sourceText.style.isFauxBold; |
レイヤーのテキストが斜体であるか | text.sourceText.style.isFauxItalic; |
テキストに塗りを適用 | style.applyFill; |
テキストレイヤーの塗りのカラーの値 返り値=配列 |
style.fillColor; style.fillColor[2]; |
0 ~ 1.0 の範囲で RGB の値を返す。 R,G, B の値は、要素番号[ ]に0,1,2。 |
|
テキストに線を適用 | style.applyStroke; |
テキストレイヤーの線の太さ | style.strokeWidth; |
トラッキング値 | style.tracking; |
行送り値 | style.leading; |
自動行送りのON OFF | style.autoLeading; |
特定の文字インデックスの値 | getStyleAt(0); |
ある時間で特定の文字インデックスの値 n=文字インデックス、x=秒単位の時間 |
getStyleAt(n,x); |
別のレイヤーの文字インデックスのスタイル | thisComp.layer("source layer name").text.sourceText.style; |
別レイヤーの特定の文字インデックスと時間(オプション)の値 | thisComp.layer("source layer name").text.sourceText.getStyleAt(0,5); |
末尾に .style を使用することは getStyleAt(0); を使用することと同じ | text.sourceText.style; |
特定のテキストプロパティ値を返すには getStyleAt(0) の後に「font」または「fontStyle」を追加 | getStyleAt(4).fontSize; getStyleAt(3).font; |
スタイルと実際のソーステキストの両方の値を同時に返す | thisComp.layer("source layer name").text.sourceText.getStyleAt(0,0); |
スタイルとテキストの両方に対する Set 関数: | style.setFont(thisComp.layer("source layer name").text.sourceText.style.font); |
※空のスタイルを作成するには(Set 関数を使用して特定の値を作成) | text.sourceText.createStyle(); |
スタイルを作成し、Set 関数 ** を使用して特定の値を設定する(ロングフォーム): | styleA = thisComp.layer(""source layer name"").text.sourceText.createStyle(); styleB = styleA.setFontSize(300); styleC = styleB.setFont(""Impact""); styleC;" |
スタイルを作成し、Set 関数 ** を使用して特定の値を設定する(ショートフォーム): | text.sourceText.createStyle().setFontSize(300).setFont("Impact"); |
Get 関数で文字インデックス値を返し、Set 関数で特定の値の一部を上書きする | style = text.sourceText.getStyleAt(3); style = style.setFontSize(150); style = style.setFont(thisComp.layer("source later text").text.sourceText.style.font); style; |
インデックスでレイヤーを参照 | style = thisComp.layer(1).text.sourceText.getStyleAt(0); style.setText(thisComp.layer(1).text.sourceText); |
スタイルを適用するSet 関数 |
newStyle = style.setBaselineShift(new_value); newStyle = style.setApplyFill(true/false); newStyle = style.setFillColor([1.0,1.0,1.0]) // RGB 値の配列 newStyle = style.setApplyStroke(true/false) newStyle = style.setStrokeColor([1.0,1.0,1.0]) // RGB 値の配列 newStyle = style.setStrokeWidth(new_value) newStyle = style.setTracking(new_value); newStyle = style.setLeadig(new_value); newStyle = style.setAutoLeading(true); newStyle = style.setAutoLeading(true); |
テキストのベースラインシフト値を設定 | style.setBaselineShift(new_value); |
テキストの塗りをオンまたはオフ | style.setApplyFill(true/false); |
塗りのカラーを定義する場合に setApplyFill と組み合わせて使用 | style.setFillColor([1.0,1.0,1.0]) // RGB 値の配列 |
テキストレイヤーの線をオンまたはオフ | style.setApplyStroke(true/false) |
テキストの線幅を設定する | style.setStrokeWidth(new_value) |
トラッキング値を設定 | style.setTracking(new_value); |
行送り値を設定 | style.setLeadig(new_value); |
AutoLeading をオンまたはオフ | style.setAutoLeading(true); |
まとめてセットする例 | text.sourceText.style.setFillColor(hexToRgb("00FF00")). setApplyStroke(1).setStrokeWidth(5).setStrokeColor([1,0,0]).setFontSize(200); |