Copy link to clipboard
Copied
Hi,
I have a function that gets the x-y co-ordinates of the first text character in a paragraph:
function topLeftPoint(targetDoc, targetPgf) {
// get loc of first text character in the pgf
var firstCharOffset = (targetPgf.GetText(Constants.FTI_String))[0].offset;
var txtLoc = new TextLoc(targetPgf, firstCharOffset);
// get top-left Point relative to the parent SubCol
return new Point(
targetDoc.GetTextVal(txtLoc, Constants.FP_LocX).ival,
targetDoc.GetTextVal(txtLoc, Constants.FP_LocY).ival
);
}
The FDK docs say that LocY gives the "Offset of the top of a character from the
top of the subcolumn", but it actually seems to get the y pos of the baseline.
Am I doing something wrong, or is the documentation just inacurate?
And does anyone know how to get the y pos of the top?
The best I've managed is to subtract the FP_LineAscent, but that's not quite the top 😞
I was able to get it in the end by doing:
LocY - LineAscent - (FontSize / 10)
A bit messy, but does the job.
Copy link to clipboard
Copied
Hi ReedError,
From the work with graphic textlines I know this:
I do not know which font property gives the distance from baseline to the upper bound of the line. It may be the font-size, but I'm not certain. The pink highlight is created with the character format Background. Keep in mind that there must be room for accents, such as Â.
Copy link to clipboard
Copied
I was able to get it in the end by doing:
LocY - LineAscent - (FontSize / 10)
A bit messy, but does the job.