Skip to main content
davidc88034496
Known Participant
February 27, 2023
Question

Adobe XD - Plugin - JavaScript - UXP - StyleRanges question

  • February 27, 2023
  • 0 replies
  • 196 views

So, im trying to understand the styleRanges a bit more.
Im not sure if i quite understand correctly
https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#Text-styleRanges 


Visually, within Adobe XD, i can see that all the same styles are applied continously within the text's field.
However, when i console.log styleRanges, I am getting mutiple 'ranges' or multiple indexes within the array.  In my mind, this should not be happening since every character has the same styling. The length of the array should be one and that one index should contain only one object of styling since every character shares the same style.  
Why is it that i am getting more than one?


I even checked each property and they all match.


Below are two objects within the array

StyleRanges: []
Object One:

  1. charSpacing: -50
  2. fill: {value: 4290710426}
  3. fontFamily: "Arial"
  4. fontSize: 36
  5. fontStyle: ""
  6. hyperlinkUrl: ""
  7. length: 8
  8. linkId: ""
  9. strikethrough: false
  10. textScript: "none"
  11. textTransform: "none"
  12. underline: false
  13. [[Prototype]]: Object

    ObjectTwo:
  1. charSpacing: -50
  2. fill: {value: 4290710426}
  3. fontFamily: "Arial"
  4. fontSize: 36
  5. fontStyle: ""
  6. hyperlinkUrl: ""
  7. length: 8
  8. linkId: ""
  9. strikethrough: false
  10. textScript: "none"
  11. textTransform: "none"
  12. underline: false
  13. [[Prototype]]: Object
This topic has been closed for replies.