Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

find position of text

Explorer ,
Jun 09, 2012 Jun 09, 2012

I'm trying to get the position of point text from left anchor if left aligned, middle if center aligned and right if right aligned. is this even possible?

here are the keys of object I am trying to get at, if that helps

keys:

story : [Story]

contents : export me

textRange : [TextRange]

textSelection : [TextRange]

rowCount : 1

columnCount : 1

rowGutter : 0

columnGutter : 0

flowLinksHorizontally : true

spacing : 0

opticalAlignment : false

kind : TextType.POINTTEXT

contentVariable : undefined

orientation : TextOrientation.HORIZONTAL

this is what I am using to get at it:

app.activeDocument.textFrames[2].anchor[0]

am i confusing anchor point with baseline position?

TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Mentor ,
Jun 11, 2012 Jun 11, 2012

This looks right to me what makes you question it? Anchor is only valid for point text… If you have no baseline shift then I would expect it to be the same as baseline of the first para

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2012 Jun 12, 2012

I am not sure what was going on, I found another post where you mentioned outlining text. so did something like:

var temporaryText = currentTextItem.duplicate().createOutline(),

     // temporaryText is defined earlier

     left = Math.round(temporaryText.visibleBounds[0]),

     top = Math.abs(Math.round(temporaryText.visibleBounds[1])),

     right = Math.round(temporaryText.visibleBounds[2]),

     bottom = Math.abs(Math.round(temporaryText.visibleBounds[3]));

temporaryText.remove();

that way I can get all the bounding boxes exactly without wierd vector problems. Note I add the round and absolute math function so that I can get positive/even numbers, just easier for my brain to processes.

seems to work now though. very weird.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 12, 2012 Jun 12, 2012
LATEST

That I think is the only way to get bounds of type as here…

Screen shot 2012-06-12 at 14.44.22.png

Anchor is the actual path point… As here for range left…

Screen shot 2012-06-12 at 14.43.00.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines