+size_t u8_strpad_colorcodes(char *out, size_t outsize, const char *in, qboolean leftalign, size_t minwidth, size_t maxwidth)
+{
+ size_t l = u8_bytelen_colorcodes(in, maxwidth);
+ size_t actual_width = u8_strnlen_colorcodes(in, l);
+ int pad = (int)((actual_width >= minwidth) ? 0 : (minwidth - actual_width));
+ int prec = (int)l;
+ int lpad = leftalign ? 0 : pad;
+ int rpad = leftalign ? pad : 0;
+ return dpsnprintf(out, outsize, "%*s%.*s%*s", lpad, "", prec, in, rpad, "");
+}
+