TODO: width of line
497882
protected function doDrawPolygon(array $x, array $y, $type)
    {
        list($image, $point) = $this->getCurrentClip();
        
        $color = $this->createColor($this->state['fillColor']);
        
        $fill = $type > 0;
        
        $coords = array();
        
        foreach($x as $i => $coord)
        {
            $coords[] = $this->translatePoint($point, $coord, $this->convertYCoord($y[$i]));
        }
        
        $polygons = array();
        
        if($this->isFillShape($type))
        {
            $polygons[] = array($this->createColor($this->state['fillColor']), true);
        }
        
        if($this->isStrokeShape($type))
        {
            $polygons[] = array($this->createColor($this->state['lineColor']), false);
        }
        
        foreach($polygons as $polygon)
        {
            list($color, $fill) = $polygon;
            $image->draw()->polygon($coords, $color, $fill);
        }
    }
897490
function wrap(text, width, wrapSplitter) {
  var lineHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1.2;

  text.each(function () {
    var text = select(this),
        words = text.text().split(wrapSplitter || /[ \t\r\n]+/).reverse().filter(function (w) {
      return w !== "";
    });
    var word = void 0,
        line$$1 = [],
        tspan = text.text(null).append("tspan").attr("x", 0).attr("dy", 0.8 + "em");

    while (word = words.pop()) {
      line$$1.push(word);
      tspan.text(line$$1.join(" "));
      if (tspan.node().getComputedTextLength() > width && line$$1.length > 1) {
        line$$1.pop();
        tspan.text(line$$1.join(" "));
        line$$1 = [word];
        tspan = text.append("tspan").attr("x", 0).attr("dy", lineHeight + "em").text(word);
      }
    }
  });
}
254327
def _padleft(width, s, has_invisible=True):
    

    def impl(val):
        iwidth = width + len(val) - len(_strip_invisible(val)) if has_invisible else width
        fmt = "{0:>%ds}" % iwidth
        return fmt.format(val)

    num_lines = s.splitlines()
    return len(num_lines) > 1 and '\n'.join(map(impl, num_lines)) or impl(s)
1363032
def _visual_width(line):
    """"""

    return len(re.sub(colorama.ansitowin32.AnsiToWin32.ANSI_CSI_RE, "", line))
312586
def doLayout(self, width):
        

        # Calculate dimensions
        self.width = width

        font_sizes = [0] + [frag.get("fontSize", 0) for frag in self]
        self.fontSize = max(font_sizes)
        self.height = self.lineHeight = max(frag * self.LINEHEIGHT for frag in font_sizes)

        # Apply line height
        y = (self.lineHeight - self.fontSize) # / 2
        for frag in self:
            frag["y"] = y

        return self.height
422877
function checkLength(str) {
        var ctm = ctx.measureText(str);
        return ctm.width <= tm.width;
      }
456455
def get_string_width(self, s):
        ""
        s = self.normalize_text(s)
        cw=self.current_font['cw']
        w=0
        l=len(s)
        if self.unifontsubset:
            for char in s:
                char = ord(char)
                if len(cw) > char:
                    w += cw[char] # ord(cw[2*char])<<8 + ord(cw[2*char+1])
                #elif (char>0 and char<128 and isset($cw[chr($char)])) { $w += $cw[chr($char)]; }
                elif (self.current_font['desc']['MissingWidth']) :
                    w += self.current_font['desc']['MissingWidth']
                #elif (isset($this->CurrentFont['MissingWidth'])) { $w += $this->CurrentFont['MissingWidth']; }
                else:
                    w += 500
        else:
            for i in range(0, l):
                w += cw.get(s[i],0)
        return w*self.font_size/1000.0
156259
private float  calculateTextWidth(TextContainer parentTextObj)
   {
      TextWidthCalculator  proc = new TextWidthCalculator();
      enumerateTextSpans(parentTextObj, proc);
      return proc.x;
   }
622566
def parse_fixed_width(types, lines):
    """"""
    values = []
    line = []
    for width, parser in types:
        if not line:
            line = lines.pop(0).replace('\n', '')

        values.append(parser(line[:width]))
        line = line[width:]

    return values
565151
def outlineWidth(self, value):
        """"""
        if isinstance(value, (int, float, long)) and \
           not self._outline is None:
            self._outline['width'] = value
1060158
def width(self, width=None):
        """"""

        if width is None:
            return self._width
        else:
            if not is_numeric(width):
                raise TypeError("width must be numeric, not '%s'" % str(width))
            self._width = width
988253
private function getLineWidth()
    {
        $line_width = isset($_ENV['COLUMNS']) && $_ENV['COLUMNS']
                    ? $_ENV['COLUMNS']
                    : 0;

        if ($line_width === 0) {
            $line_width = exec('tput cols');
        }

        return $line_width;
    }
428100
function() {

      var textLines = this.text.split(/\r?\n/),
          lineTopOffset = this.useNative
            ? this.fontSize * this.lineHeight
            : (-this._fontAscent - ((this._fontAscent / 5) * this.lineHeight)),

          textLeftOffset = -(this.width/2),
          textTopOffset = this.useNative
            ? this.fontSize - 1
            : (this.height/2) - (textLines.length * this.fontSize) - this._totalLineHeight,

          textAndBg = this._getSVGTextAndBg(lineTopOffset, textLeftOffset, textLines),
          shadowSpans = this._getSVGShadows(lineTopOffset, textLines);

      // move top offset by an ascent
      textTopOffset += (this._fontAscent ? ((this._fontAscent / 5) * this.lineHeight) : 0);

      return [
        '<g transform="', this.getSvgTransform(), '">',
          textAndBg.textBgRects.join(''),
          '<text ',
            (this.fontFamily ? 'font-family="\'' + this.fontFamily + '\'" ': ''),
            (this.fontSize ? 'font-size="' + this.fontSize + '" ': ''),
            (this.fontStyle ? 'font-style="' + this.fontStyle + '" ': ''),
            (this.fontWeight ? 'font-weight="' + this.fontWeight + '" ': ''),
            (this.textDecoration ? 'text-decoration="' + this.textDecoration + '" ': ''),
            'style="', this.getSvgStyles(), '" ',
            /* svg starts from left/bottom corner so we normalize height */
            'transform="translate(', toFixed(textLeftOffset, 2), ' ', toFixed(textTopOffset, 2), ')">',
            shadowSpans.join(''),
            textAndBg.textSpans.join(''),
          '</text>',
        '</g>'
      ].join('');
    }
440873
private double getWidthForMappingLine(RendererModel model) {
        double scale = model.getParameter(Scale.class).getValue();
        return mappingLineWidth.getValue() / scale;
    }
232162
def width
      string = to_s
      max_width = 0
      string.each_line do |line|
        max_width = [max_width, line.uncolored.chomp.size].max
      end
      max_width
    end
916279
def set_line_width(self, width=1.):
        
        width = float(width)
        if width < 0:
            raise RuntimeError('Cannot have width < 0')
        self.glir.command('FUNC', 'glLineWidth', width)
355161
function getOffsetWidth(el) {
    var rect = el.getBoundingClientRect();
    return rect.width || rect.right - rect.left;
  }