Text array and size with function

Hello,

I am trying to do this…
image
And I have the following so far… how could I change the width depending on the word?
so sorry for the many messages, thanks very much!

var parrafo = "This is big and this small";
var parrafo_array;

function setup() {
	createCanvas(1024, 768);
	background("white");
	fill(50);
	textLeading(25);
	parrafo_array = parrafo.split(' ');
}

function draw () {
    text(parrafo_array, height/2, height/2, textoWidth(palabra));
}

function  textoWidth(palabra) {
   if (palabra == 'big') {
   return 400;} 
 
   if (palabra == 'small') {
   return 10;
   }
}

Hello @luciaromancanivell,

This is a hint only:

  textSize(24);  
  text(parrafo_array[0], 100, height/2);
  let tw0 = textWidth(parrafo_array[0]); // Text width for this string and textSize()

Reference:
https://p5js.org/reference/#/p5/textWidth

The next word starts at the end of the first word which you have the textWidth() for.

This was the x location for the last word in my code:
100+ tw0 + tw1 + tw2 + tw3

I was able to do this by building on the hint I provided:
image

:)