This post is a follow up to this related post.
I need to get the position and orientation of the first and the last character in a text frame art, that is, I need its matrix.
There are a number of functions in the API that is supposed to help you; here's a snippet from the file ATESuites.h
/** Return transformation matrix of this run.
The matrix returned spesify the full transformation of the given run. You need to transform the origin by IGlyphRun::GetOrigins() and
concat with ITextFrame::GetMatrix() in order to get the location of the glyphs.
ATEErr (*GetMatrix) ( GlyphRunRef glyphrun, ASRealMatrix* ret);
Hence, getting the matrix of the first character or glyph should look something like this:
VMGetFirstTextMatrix( AIArtHandle textArt, AIRealMatrix *matrix)
ASRealMatrix frameMatrix, glyphMatrix;
sAITextFrame->GetATETextFrame( textArt, &ateTextRef);
ITextFrame textFrame( ateTextRef);
ITextLinesIterator lnItr = textFrame.GetTextLinesIterator();
ITextLine txtLine = lnItr.Item();
IGlyphRunsIterator grItr = txtLine.GetGlyphRunsIterator();
IGlyphRun glyphRun = grItr.Item();
IArrayRealPoint pointArray = glyphRun.GetOrigins();
firstPoint = pointArray.Item(0); // comes out with wrong values!!!
frameMatrix = textFrame.GetMatrix();
glyphMatrix = glyphRun.GetMatrix();
sMath->AIRealMatrixConcat( (AIRealMatrix*) &glyphMatrix,
catch (ATE::Exception e)
But the coordinates, either returned in frameMatrix (tx and ty) or the firstPoint are obviously wrong. It appears that they an offset which is allmost constant. The x-values are approx 7664 points too large (give and take a few decimals), and the y-values are approx 7893 too large (also give and take a few decimals).
I'm reall puzzled by this, because I need to get accurate positions...