Right-justify text for a total of `width` graphemes

    The `width` is based on graphemes::

        >>> s = 'Â'
        >>> s.rjust(2)
        'Â'
        >>> rjust(s, 2)
        ' Â'
502403
def rjust(text, width, fillchar=' '):
    
    len_text = grapheme_len(text)
    return fillchar * (width - len_text) + text
666082
def getBottomRight(self):
        
        return (float(self.get_x()) + float(self.get_width()), float(self.get_y()))
1047699
def _multiline_width(multiline_s, line_width_fn=len):
    """"""
    return max(map(line_width_fn, re.split("[\r\n]", multiline_s)))
1042394
def fmt_content(text, width = 0, align = '<', padding = None, padding_left = None, padding_right = None, padding_char = ' '):
        
        if padding_left is None:
            padding_left = padding
        if padding_right is None:
            padding_right = padding
        if padding_left is not None:
            text = '{}{}'.format(str(padding_char)[0] * int(padding_left), text)
        if padding_right is not None:
            text = '{}{}'.format(text, str(padding_char)[0] * int(padding_right))
        if width:
            strptrn = '{:' + ('{}{}{}'.format(str(padding_char)[0], str(TEXT_ALIGNMENT[align]), str(width))) + 's}'
            text = strptrn.format(text)
        return text
40713
def right_align(value, length):
    
    if length <= 0:
        return u""

    value = text_type(value)

    if len(value) < length:
        return (" " * (length - len(value))) + value
    else:
        return value[-length:]
511808
function (expr, length, fillChar) {
  fillChar = fillChar || ' ';
  var string = '' + expr;
  if (string.length > length) {
    return right(string, length);
  } else {
    while (string.length < length) {
      string = string + fillChar;
    }
  }
  return string;
}
468993
def center_str(txt, font_name, font_size, offset=0):
    """"""
    return -(text_width(txt, font_name, font_size) / 2.0) + offset
1347756
def fmt_margin(text, margin = None, margin_left = None, margin_right = None, margin_char = ' '):
        
        if margin_left is None:
            margin_left = margin
        if margin_right is None:
            margin_right = margin
        if margin_left is not None:
            text = '{}{}'.format(str(margin_char)[0] * int(margin_left), text)
        if margin_right is not None:
            text = '{}{}'.format(text, str(margin_char)[0] * int(margin_right))
        return text
702397
function pad(text, width) {
  var space = (width - text.length) + 5;
  return text + Array(space).join(" ");
}
44517
def text_width(string, font_name, font_size):
    """"""
    return stringWidth(string, fontName=font_name, fontSize=font_size)
374781
function measureText (nodes, parentNode) {
  let width = 0
  for (let i = 0; i < nodes.length; i++) {
    const node = nodes[i]
    width += measure(node.textContent, node.nodeType === 1 ? node : parentNode)
  }
  return width
}
1371498
def get_align(text):
    ""
    (x1, x2, h, v, a) = unaligned_get_dimension(text)
    return (h, v, a)
147310
def right(ctx, text, num_chars):
    
    num_chars = conversions.to_integer(num_chars, ctx)
    if num_chars < 0:
        raise ValueError("Number of chars can't be negative")
    elif num_chars == 0:
        return ''
    else:
        return conversions.to_string(text, ctx)[-num_chars:]
725415
def printstring_formatted_right(r,c,content, color, att = Ncurses::A_NORMAL)
      clean = content.gsub /#\[[^\]]*\]/,''  # clean out all markup
      #c = actual_width() - clean.length # actual width not working if resize
      c = getmaxx() - clean.length
      printstring_formatted(r,c,content, color, att )
    end
1302812
function (x, y, width, height, r, strokeWidth) {

		if (isObject(x)) {
			y = x.y;
			width = x.width;
			height = x.height;
			r = x.r;
			strokeWidth = x.strokeWidth;
			x = x.x;
		}
		var wrapper = this.symbol('rect');
		wrapper.r = r;

		return wrapper.attr(wrapper.crisp(strokeWidth, x, y, mathMax(width, 0), mathMax(height, 0)));
	}
1039732
private String getJustifiedText(String text) {
        String[] words = text.split(NORMAL_SPACE);

        for (String word : words) {
            boolean containsNewLine = (word.contains("\n") || word.contains("\r"));

            if (fitsInSentence(word, currentSentence, true)) {
                addWord(word, containsNewLine);
            } else {
                sentences.add(fillSentenceWithSpaces(currentSentence));
                currentSentence.clear();
                addWord(word, containsNewLine);
            }
        }

        //Making sure we add the last sentence if needed.
        if (currentSentence.size() > 0) {
            sentences.add(getSentenceFromList(currentSentence, true));
        }

        //Returns the justified text.
        return getSentenceFromList(sentences, false);
    }
138681
private int getCharWidth(String text, Align align)
    {
        final int width;
        if (align == Align.RIGHT)
        {
            width = getTextWidth(text);
        }
        else if (align == Align.CENTER)
        {
            width = getTextWidth(text) / 2;
        }
        else
        {
            width = 0;
        }
        return width;
    }