I have a script putting some elements on screen — a rectangle and a couple of text items.
While the top and left position of the rectangle falls exactly where it's supposed to, I can't quite figure out what top value of a textFrame item means. See the code and corresponding result — the text items' baselines are slightly below the top of the rectangle. Why and how can I precisely control the placement of text items, specifically the "top" value as it seems not to correspond to anything?
// For loop // Box var dayBox = docRef.pathItems.rectangle( dayTop, dayLeft, dayWidth, dayHeight ); dayBox.filled = false; dayBox.stroked = true; dayBox.strokeColor = newColor; dayBox.strokeWidth = sDay; // Text var dayNameText = docRef.textFrames.add(); var k = new Date(year, m, d); var dayName = k.getDayNameShort(ypLang); dayNameText.contents = dayName; dayNameText.top = dayTop; // "top" of what? dayNameText.left = dayLeft; dayNameParaStyle.applyTo(dayNameText.textRange); dayNameCharStyle.applyTo(dayNameText.textRange); var dayNumberText = docRef.textFrames.add(); dayNumberText.contents = d + 1; dayNumberText.top = dayTop; // ? dayNumberText.left = dayRight; dayNumberParaStyle.applyTo(dayNumberText.textRange); dayNumberCharStyle.applyTo(dayNumberText.textRange);