/* This file is part of tooldemo, a sample Tool plugin for Adobe Illustrator Copyright (C) 2002-5 Toby Thain, toby@telegraphics.com.au This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "common.h" #include "IText.h" extern AIArtHandle group; AIErr new_text(AINUMBER tx,AINUMBER ty,float angledeg,char *str){ AIArtHandle textFrame; AIErr e; AIRealPoint anchor={tx,ty}; if(!(e = sAITextFrame->NewPointText(kPlaceInsideOnTop, group, kHorizontalTextOrientation, anchor, &textFrame) ) ){ TextRangeRef range; if(!(e = sAITextFrame->GetATETextRange(textFrame, &range))){ ATE::ITextRange crange(range); crange.InsertAfter(str); } } /* if( !(e = sArt->NewArt( kTextArt, kPlaceInsideOnTop, group, &text )) && !(e = sText->SetTextType(text,kPointTextType)) && !(e = sTextStream->OpenStream( text, kWriteStreamMode, &stream )) && !(e = sTextStream->GetPathStyleStream( stream, &pathStyle )) ){ pathStyle.fillPaint = true; pathStyle.strokePaint = false; pathStyle.fill.color.kind = kGrayColor; pathStyle.fill.color.c.g.gray = ONECONSTANT; count = strlen(str); if(!(e = sTextStream->SetPathStyleStream( stream, &pathStyle )) && !(e = sTextStream->WriteStream( stream, &count, str )) ) e = sTextStream->CloseStream( stream ); // BUG? the MatrixSetRotate calls in Fixed and Real suites // appear to use different polarities for the angle??? MATRIXSETROTATE(&mtx,DEGREETORADIAN(TONUMBER(angledeg))); MATRIXCONCATTRANSLATE(&mtx,tx,ty); sTextPath->GetFirstTextPath(text,&tpath); sTextPath->SetTextPathMatrix(tpath,&mtx); } */ return e; }