Discuss and collaborate on GML scripts

You are not logged in.

#1 2009-05-20 17:30:58

Registered: 2008-12-11
Posts: 72

Draw_text_ext doesn't wrap long words

References:  [1]

draw_text_ext is often used to wrap strings however when using a word longer than the stated string width it will not split it up as it only splits the string up at spaces or - characters. You can use this replacement function to get the proper functionality:

var str;
str = argument2;
if (string_width_ext(str,argument3,argument4) > argument4)
  var i;
  for (i = 1; i <= string_length(str); i += 1)
    if (string_width_ext(string_copy(str,1,i),argument3,argument4) > argument4)
      str = string_insert(chr(13),str,i);

Last edited by flexaplex (2009-06-16 08:30:55)


Board footer

Powered by FluxBB