Adobe Illustrator Script情報 Version 9.0.2、10
back

3種類の Text (vb)
TextType TextArtItems には、3種類の Text があります。

左図において上から順に、PointText, AreaText, PathText です。

これを VB から指定するには、

TextArt.Kind = aiPointText

TextArt.Kind = aiAreaText   AreaText の VB の例

TextArt.Kind = aiPathText   PathText の VB の例

とします。

PointText の VB の例を示します。
Private Sub Command1_Click()

Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim textColor As New Illustrator.Color
Dim textRGBColor As New Illustrator.RGBColor
Dim curtextArt As Illustrator.TextArtItem

Set frontDocument = appRef.Documents.Add(aiDocumentRGBColor, 600, 800)
             
    With textRGBColor
            .Red = 0
            .Green = 200
            .Blue = 0
    End With
    textColor.RGB = textRGBColor
    
Set curtextArt = frontDocument.ActiveLayer.TextArtItems.Add
    With curtextArt
        .Kind = aiPointText
        .Contents = "ポイント"
        .Position = Array(80, 730)              ' 開始位置(x,y)
        With .TextRange
                .Filled = True                  ' 塗りつぶし
                .FillColor = textColor          ' 色
                .Stroked = False                ' 輪郭
                .Font = "MS-PMincho"            ' MS-PGothic
                .Size = 50                      ' サイズ
        End With
    End With

Set curtextArt = frontDocument.ActiveLayer.TextArtItems.Add
    With curtextArt
        .Kind = aiPointText
        .Contents = "テキスト"
        .Position = Array(80, 660)              ' 開始位置(x,y)
        With .TextRange
                .Filled = True                  ' 塗りつぶし
                .FillColor = textColor          ' 色
                .Stroked = False                ' 輪郭
                .Font = "MS-PMincho"            ' MS-PGothic
                .Size = 50                      ' サイズ
        End With
    End With

End Sub