如何使用C#从Adobe Illustrator(.ai)TextFrame获取FontSize?
我正在使用C#中的Adobe Illustrator库成功读取Adobe Illustrator文件,但无法获取文本框的字体大小。有人能帮忙吗?下面是我使用的代码:如何使用C#从Adobe Illustrator(.ai)TextFrame获取FontSize?,c#,font-size,adobe-illustrator,C#,Font Size,Adobe Illustrator,我正在使用C#中的Adobe Illustrator库成功读取Adobe Illustrator文件,但无法获取文本框的字体大小。有人能帮忙吗?下面是我使用的代码: Illustrator.Application aiApp = new Illustrator.Application(); Illustrator.Document doc = aiApp.Open(@"K:\test\test.ai",Illustrator.AiDocumentColorSpace.aiDocumentRGB
Illustrator.Application aiApp = new Illustrator.Application();
Illustrator.Document doc = aiApp.Open(@"K:\test\test.ai",Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, null);
List<Label> _labela = new List<Label>();
int cntr = 0;
foreach (TextFrame tf in doc.TextFrames)
{
_labela.Add(new Label());
// caktojme vetite per secilen label
_labela[cntr].Name = "lblTextFrame" + cntr;
_labela[cntr].AutoSize = true;
_labela[cntr].Text = tf.Contents;
_labela[cntr].ForeColor = Color.FromArgb((int)tf.Layer.Color.Red, (int)tf.Layer.Color.Green, (int)tf.Layer.Color.Blue);
_labela[cntr].Top = Math.Abs((int)tf.Top);
_labela[cntr].Left = Math.Abs((int)tf.Left);
cntr++;
}
foreach (Label lbl in _labela)
{
//lbl.BackColor = Color.Black;
this.Controls.Add(lbl);
this.SuspendLayout();
this.Refresh();
}
}
Illustrator.Application aiApp=new Illustrator.Application();
Illustrator.Document doc=aiApp.Open(@“K:\test\test.ai”,Illustrator.AiDocumentColorSpace.aiDocumentRGBColor,null);
列表_labela=新列表();
int-cntr=0;
foreach(doc.TextFrames中的TextFrame)
{
_添加(新标签());
//caktojme vetite符合secilen标签
_labela[cntr].Name=“lblTextFrame”+cntr;
_labela[cntr].AutoSize=true;
_labela[cntr].Text=tf.Contents;
_labela[cntr].ForeColor=Color.FromArgb((int)tf.Layer.Color.Red,(int)tf.Layer.Color.Green,(int)tf.Layer.Color.Blue);
_labela[cntr].Top=Math.Abs((int)tf.Top);
_labela[cntr].Left=Math.Abs((int)tf.Left);
cntr++;
}
foreach(标签lbl在_labela中)
{
//lbl.BackColor=颜色。黑色;
this.Controls.Add(lbl);
这个.SuspendLayout();
这个。刷新();
}
}
我没有看到TextFrame.FontSize的任何属性??:(.有什么建议吗?你是这样读字体名称和大小的
for (int i = 1; i <= doc.TextFrames.Count; i++)
{
Illustrator.TextFrame tF = doc.TextFrames[i];
Illustrator.TextFont objFont = tF.TextRange.CharacterAttributes.TextFont;
double size = tF.TextRange.CharacterAttributes.Size;
Console.WriteLine("Size: {0}, FontName: {1})", size, objFont.Name);
}
for(int i=1;i