prints given text to window, in color at x and y coordinates
 @param [Window] window to write to
 @param [String] text to print
 @param [int] color pair such as $datacolor or $promptcolor
 @param [int] x  row
 @param [int] y  col
 @see Window#printstring
183075
def print_this(win, text, color, x, y)
      raise "win nil in print_this" unless win
      color=Ncurses.COLOR_PAIR(color);
      win.attron(color);
      #win.mvprintw(x, y, "%-40s" % text);
      win.mvprintw(x, y, "%s" % text);
      win.attroff(color);
      win.refresh
    end
221387
def _create_footer_window h = 1 , w = Ncurses.COLS, t = Ncurses.LINES-1, l = 0
      ewin = Canis::Window.new(h, w , t, l)
      #ewin.bkgd(Ncurses.COLOR_PAIR($promptcolor));
      @window = ewin
      return ewin
    end
1328187
def cprint(
    text,
    fg=Color.normal,
    bg=Color.normal,
    fg_dark=False,
    bg_dark=False,
    underlined=False,
    parse=False,
):
    
    if parse:
        color_re = Color.color_re()
        lines = text.splitlines()
        count = len(lines)
        for i, line in enumerate(lines):
            previous = 0
            end = len(line)
            for match in color_re.finditer(line):
                sys.stdout.write(line[previous : match.start()])
                d = match.groupdict()
                set_color(
                    d["color"], fg_dark=False if d["dark"] is None else True
                )
                previous = match.end()
            sys.stdout.write(
                line[previous:end]
                + ("\n" if (i < (count - 1) or text[-1] == "\n") else "")
            )
    else:
        set_color(fg, bg, fg_dark, bg_dark, underlined)
        sys.stdout.write(text)
        set_color()
108841
function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0.0, $char_space = 0.0, $angle = 0.0) { //***
		//Helpers::dompdf_debug("trace", "($x, $y, $text, ". basename($font) .", $size, [$color[0], $color[1], $color[2]], $adjust, $angle, $blend, $opacity)");

		list ($r, $g, $b) = $this->_get_rgb($color);
		$this->_pdf->SetTextColor($r, $g, $b);
		//***$this->_set_line_transparency($blend, $opacity);
		//***$this->_set_fill_transparency($blend, $opacity);

		$fontdata = $this->_get_font($font);
		$this->_pdf->SetFont($fontdata['family'], $fontdata['style'] /*strpos($font, '-Bold') === false ? '' : 'B'*/, $size, $font);

		//$this->_pdf->SetFontSize($size); // ???

		if ($adjust > 0) {
			$a = explode(' ', $text);
			//$this->_pdf->SetXY($x - 3, $y + (self::FONT_HEIGHT_SCALE - 1) * $size);
			$this->_pdf->SetXY($x, $y);

			//$y += self::FONT_HEIGHT_SCALE * $size + 1;
			for ($i = 0; $i < count($a)-1; $i++) {
				$this->_pdf->Write($size, $a[$i].' ', '');
				//$this->_pdf->Text($x, $y, $a[$i].' ');
				$this->_pdf->SetX($this->_pdf->GetX()+$adjust);
				//$x += $this->_pdf->GetX() + $adjust;
			}
			$this->_pdf->Write($size, $a[$i], '');
			//$this->_pdf->Text($x, $y, $a[$i].' ');
		}
		else {
			if ($angle != 0) {
				$this->_pdf->StartTransform();
				//$y += self::FONT_HEIGHT_SCALE * $size;
				//$y += $size;
				$this->_pdf->Rotate(-$angle, $x, $y);
				$this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
				$this->_pdf->StopTransform();
			}
			else {
				//$pippo = $this->_pdf->getFontAscent($fontdata['family'], $fontdata['style'], $size);
				//$y += $pippo / 8;
				//$y = $y - 0.85 * $size;	// + 0.8 * $size;
				$this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
			}
		}
	}
1129576
function (text, color, x, y, width) {
                        ctx.fillStyle = color;
                        var metric = ctx.measureText(text);
                        if (metric.width > width) {
                            while (text !== "") {
                                metric = ctx.measureText(text + "...");
                                if (metric.width <= width) {
                                    text += "...";
                                    break;
                                }
                                text = text.substr(0, text.length - 1);
                            }
                        }
                        ctx.fillText(text, x, y, width);
                    }
667355
public void println(int tempIndent, char x) {
    if (startOfLine) {
      doIndent(tempIndent);
    }
    super.println(x);
    startOfLine = true;
  }
1127327
def cprint(text, fg=grey, bg=blackbg, w=norm, cr=False, encoding='utf8'):
    ''' 
    '''
    colorstart(fg, bg, w)
    out(text)
    colorend(cr)
69229
def print(formatted = nil)
      result = name
      unless version.nil?
        result += ", version #{version}"
      end
      if formatted
        result = "#{FORMATTING_STAR.colorize(:yellow)} #{result}"
      end
      result
    end
11730
public static function printLine($text = '', $type = 'normal')
    {
        $colorList = array(
            'normal' => '0',
            'information' => '1;34',
            'success' => '1;32',
            'warning' => '1;33',
            'error' => '1;31'
        );
        $color = isset($colorList[$type]) ? $colorList[$type] : $colorList['normal'];
        $string = sprintf('%s[%sm%s%s[0m%s', chr(27), $color, $text, chr(27), PHP_EOL);
        echo($string);
    }
358190
def repaint
      return unless @repaint_required
      bc = $datacolor
      bordercolor = @border_color || bc
      borderatt = @border_attrib || Ncurses::A_NORMAL
      @window.print_border row, col, height, width, bordercolor, borderatt
      #print_borders
      print_title
      @repaint_required = false
    end
427276
def repaint
      return if !@visible
      return unless @repaint_required
      @repaint_required = false
      @color_pair = get_color($reversecolor, @color, @bgcolor)
      @window ||= create_window_menubar
      #@window.printstring( 0, 0, "%-*s" % [@cols," "], @color_pair) # this becomes blank in some terms
      c = 1; r = 0;
      @items.each do |item|
        item.row = r; item.col = c; item.coffset = c; item.parent = self
        item.color = @color
        item.bgcolor = @bgcolor
        @window.printstring( r, c, " %s " % item.text, @color_pair)
        # 2011-09-26 V1.3.1 quick dirty highlighting of first menu on menubar
        # on opening since calling highlight was giving bug in parent.width
        #if c == 1
          #att =  Ncurses::A_REVERSE
          #@window.mvchgat(y=r, x=c+1, item.text.length+1, att, @color_pair, nil)
        #end
        c += (item.text.length + 2)
      end
      #@items[0].on_enter # 2011-09-25 V1.3.1  caused issues when toggling, first item fired on DOWN
      @items[0].highlight unless @keep_visible # 2011-09-26 V1.3.1   fixed to take both cases into account
      @window.wrefresh
    end
127782
def write_color(self,text, attr=None):
        
        '''
        if isinstance(attr,AnsiState):
            defaultstate = attr
        elif attr is None:  #use attribute form initial console
            attr = self.defaultstate.copy()
        else:
            defaultstate = AnsiState()
            defaultstate.winattr = attr
            attr = defaultstate
        chunks = terminal_escape.split(text)
        n = 0 # count the characters we actually write, omitting the escapes
        res=[]
        for chunk in chunks:
            m = escape_parts.match(chunk)
            if m:
                parts = m.group(1).split(u";")
                if len(parts) == 1 and parts[0] == u"0":
                    attr = self.defaultstate.copy()
                    continue
                for part in parts:
                    if part == u"0": # No text attribute
                        attr = self.defaultstate.copy()
                        attr.bold=False
                    elif part == u"7": # switch on reverse
                        attr.inverse=True
                    elif part == u"1": # switch on bold (i.e. intensify foreground color)
                        attr.bold=True 
                    elif len(part) == 2 and u"30" <= part <= u"37": # set foreground color
                        attr.color = trtable[int(part) - 30]
                    elif len(part) == 2 and u"40" <= part <= u"47": # set background color
                        attr.backgroundcolor = trtable[int(part) - 40]
                continue
            n += len(chunk)
            if True:
                res.append((attr.copy(), chunk))
        return n,res
548433
def println(self, text=""):
        
        if self.word_wrap:
            # find directives in complete text
            directives = ansi_color.find_directives(text, self)

            # strip ansi from text
            clean_text = ansi_color.strip_ansi_codes(text)

            # wrap clean text
            clean_lines = self.tw.wrap(clean_text)

            # print wrapped text
            index = 0
            for line in clean_lines:
                line_length = len(line)
                y = 0
                while y < line_length:
                    method, args = directives[index]
                    if method == self.putch:
                        y += 1
                    method(*args)
                    index += 1
                self.newline()
        else:
            self.puts(text)
            self.newline()
860549
public void println(String text) {
        try {
            if(autoIndent) printIndent();
            out.write(text);
            println();
        } catch(IOException ioe) {
            throw new GroovyRuntimeException(ioe);
        }
    }
784258
public static function printColor ($string, $color = 'white')
		{
			$code = 'w';
			switch ($color)
			{
				case 'black':
					$code = 'k';
					break;
				case 'cyan':
					$code = 'c';
					break;
				case 'gray':
				case 'grey':
					$code = 'K';
					break;
				case 'green':
					$code = 'g';
					break;
				case 'magenta':
					$code = 'm';
					break;
				case 'red':
					$code = 'r';
					break;
				case 'yellow':
					$code = 'y';
					break;
			}
			self::stdout(self::renderColoredString("%" . $code . $string . "%n\n"));
		}
459389
def text(self, x, y, text, attr=None):
        '''
        if attr is None:
            attr = self.attr

        pos = self.fixcoord(x, y)
        n = DWORD(0)
        self.WriteConsoleOutputCharacterW(self.hout, text, 
                                          len(text), pos, byref(n))
        self.FillConsoleOutputAttribute(self.hout, attr, n, pos, byref(n))
1044026
def ansi_print(text, fg, bg = nil, attr = nil)
      unless @out.tty?
        puts text
        return
      end

      colors = %w{black red green yellow blue magenta cyan white}
      attrs = %w{reset bold dim underscore blink reverse hidden}
      escape = "\033[%sm"
      fmt = []
      fmt << 30 + colors.index(fg.to_s) if fg
      fmt << 40 + colors.index(bg.to_s) if bg
      fmt << attrs.index(attr.to_s) if attr
      if fmt
        puts "#{escape % fmt.join(';')}#{text}#{escape % 0}"
      else
        puts text
      end
    end