How can I get width of point text?

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) ?

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

Awesome! Thanks I’ll give it a try

@jonfontanez hey are you on mac

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

@jonfontanez could you do me a favour on mac

Yeah sure, do you want to direct message me?

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

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

its on Plugin Repo name is Material Coḻor Pallets

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

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

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