How can I get width of point text?

#1

I’m creating a sample plug-in that generates text. It seems by default Text is set to pointText and dynamically resizes based on content but width is only available for AreaText because it’s a statically defined rectangle (maybe?).

Is there a way to get the calculated width of point text from XD (that takes into consideration font styles) ?

0 Likes

#2

I think textNode.localBounds.width should contain what you’re looking for (I can’t test it right now, but I think I’ve used that before)…

See https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#SceneNode-localBounds

2 Likes

#3

Awesome! Thanks I’ll give it a try

0 Likes

#4

@jonfontanez hey are you on mac

0 Likes

#5

I’m using Windows 10 for AdobeXD plug-in development (I have an old MacBook pro I use for testing)

0 Likes

#6

@jonfontanez could you do me a favour on mac

0 Likes

#7

Yeah sure, do you want to direct message me?

0 Likes

#8

You just want to test my plugin because i got mail from adobe that some feature is not working i think it fails on mac because i test it on windows its working

0 Likes

#9

No problem, send me a link to install it and I’ll give a try now

0 Likes

#10

its on Plugin Repo name is Material Coḻor Pallets

0 Likes

#11

what you have to do is install and read details provided while installing and use all shortcuts if shortcuts fails then go to developer console and report the error

0 Likes

#12

Here’s what I found:

  • command + space conflicts with finder
  • Add color to fav is confusing, wasn’t obvious what a fav is, couldn’t get the hot key to work
  • Not quite sure what select current color was for
  • Unclear when there is a failure due to no artboard being present (could you present an alert when no artboard is selected?)
  • may want to use commands.group for the created color objects to organize colors

Overall though, I did like the palette that it generated

0 Likes

#13

so on mac cmd + space opens finder right

fav is refer to top most pallets of remaining pallets

select current color puts it on big pallet and shows light and dark version of that color

0 Likes