func AlignText(str string, width int, align Align) (shift int, out string) {
	length := xs.Len(str)

	if length >= width {
		return 0, CutText(str, width)
	}

	if align == AlignRight {
		return width - length, str
	} else if align == AlignCenter {
		return (width - length) / 2, str
	}

	return 0, str
}
func AlignText(str string, width int, align Align) (shift int, out string) {
	length := xs.Len(str)

	if length >= width {
		return 0, CutText(str, width)
	}

	if align == AlignRight {
		return width - length, str
	} else if align == AlignCenter {
		return (width - length) / 2, str
	}

	return 0, str
}
func AlignText ( str string , width int , align Align ) ( shift int , out string ) { length := xs . Len ( str ) if length >= width { return 0 , CutText ( str , width ) } if align == AlignRight { return width - length , str } else if align == AlignCenter { return ( width - length ) / 2 , str } return 0 , str }
// AlignText calculates the initial position of the text
// output depending on str length and available width.
// The str is truncated in case of its lenght greater than
// width. Function returns shift that should be added to
// original label position before output instead of padding
// the string with spaces. The reason is to make possible
// to draw a label aligned but with transparent beginning
// and ending. If you do not need transparency you can
// add spaces manually using the returned shift value
AlignText calculates the initial position of the text output depending on str length and available width . The str is truncated in case of its lenght greater than width . Function returns shift that should be added to original label position before output instead of padding the string with spaces . The reason is to make possible to draw a label aligned but with transparent beginning and ending . If you do not need transparency you can add spaces manually using the returned shift value