// LineWidth returns the max width of all the lines in a cell
422016
func (c *Cell) LineWidth() uint {
	width := 0
	for _, s := range strings.Split(c.String(), "\n") {
		w := runewidth.StringWidth(s)
		if w > width {
			width = w
		}
	}
	return uint(width)
}
790961
func terminalWidthFunc(fd int) (width int) {
	var info termInfo
	_, _, errno := syscall.Syscall(procInfo.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&info)), 0)
	if errno != 0 {
		return -1
	}

	return int(info.size.x)
}
120717
func (f *File) GetColWidth(sheet, col string) (float64, error) {
	colNum, err := ColumnNameToNumber(col)
	if err != nil {
		return defaultColWidthPixels, err
	}
	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return defaultColWidthPixels, err
	}
	if xlsx.Cols != nil {
		var width float64
		for _, v := range xlsx.Cols.Col {
			if v.Min <= colNum && colNum <= v.Max {
				width = v.Width
			}
		}
		if width != 0 {
			return width, err
		}
	}
	// Optimisation for when the column widths haven't changed.
	return defaultColWidthPixels, err
}
662136
func monowidthColumns(words []string, ncols int) []string {
	// Determine max size of words in each column.
	colWidths := make([]int, ncols)
	for i, word := range words {
		col := i % ncols
		curWidth := colWidths[col]
		if len(word) > curWidth {
			colWidths[col] = len(word)
		}
	}

	// Append whitespace to each word to make columns mono-width.
	finalWords := make([]string, len(words))
	for i, word := range words {
		col := i % ncols
		width := colWidths[col]

		diff := width - len(word)
		finalWords[i] = word + strings.Repeat(" ", diff)
	}

	return finalWords
}
1114087
func (surface *XlibSurface) GetWidth() int {
	ret := int(C.cairo_xlib_surface_get_width(surface.Ptr))
	if err := surface.status(); err != nil {
		panic(err)
	}
	return ret
}
659134
func Width(str string) int {
	var r rune
	var size, n int

	for len(str) > 0 {
		r, size = utf8.DecodeRuneInString(str)
		n += RuneWidth(r)
		str = str[size:]
	}

	return n
}
268028
func stringWidth(text string) (width int) {
	g := uniseg.NewGraphemes(text)
	for g.Next() {
		var chWidth int
		for _, r := range g.Runes() {
			chWidth = runewidth.RuneWidth(r)
			if chWidth > 0 {
				break // Our best guess at this point is to use the width of the first non-zero-width rune.
			}
		}
		width += chWidth
	}
	return
}
762490
func (f *File) SetColWidth(sheet, startcol, endcol string, width float64) error {
	min, err := ColumnNameToNumber(startcol)
	if err != nil {
		return err
	}
	max, err := ColumnNameToNumber(endcol)
	if err != nil {
		return err
	}
	if min > max {
		min, max = max, min
	}

	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return err
	}
	col := xlsxCol{
		Min:         min,
		Max:         max,
		Width:       width,
		CustomWidth: true,
	}
	if xlsx.Cols != nil {
		xlsx.Cols.Col = append(xlsx.Cols.Col, col)
	} else {
		cols := xlsxCols{}
		cols.Col = append(cols.Col, col)
		xlsx.Cols = &cols
	}
	return err
}
585736
func (p *JSONProgress) width() int {
	if p.winSize != 0 {
		return p.winSize
	}
	ws, err := term.GetWinsize(p.terminalFd)
	if err == nil {
		return int(ws.Width)
	}
	return 200
}
1302725
func (s *Artwork) SetMaxWidth(v string) *Artwork {
	s.MaxWidth = &v
	return s
}
741313
func BoundWidth(b orb.Bound) float64 {
	c := (b.Min[1] + b.Max[1]) / 2.0

	s1 := orb.Point{b.Min[0], c}
	s2 := orb.Point{b.Max[0], c}

	return Distance(s1, s2)
}
768578
func (gp *GoPdf) MeasureTextWidth(text string) (float64, error) {

	err := gp.curr.Font_ISubset.AddChars(text) //AddChars for create CharacterToGlyphIndex
	if err != nil {
		return 0, err
	}

	_, _, textWidthPdfUnit, err := createContent(gp.curr.Font_ISubset, text, gp.curr.Font_Size, nil)
	if err != nil {
		return 0, err
	}
	return PointsToUnits(gp.config.Unit, textWidthPdfUnit), nil
}
506845
func (cr *Context) SetLineWidth(width float64) {
	C.cairo_set_line_width(cr.Ptr, C.double(width))
	if err := cr.status(); err != nil {
		panic(err)
	}
}
1259086
func (t *ShellTable) MaxColumnWidths() []int {
	if t.maxColumnWidths == nil {
		t.maxColumnWidths = &[]int{}
	}
	for _, r := range t.rows {
		for i, c := range r.columns {
			if len(*t.maxColumnWidths) == i {
				*t.maxColumnWidths = append(*t.maxColumnWidths, 0)
			}
			colWidth := len(c.String())
			if colWidth > (*t.maxColumnWidths)[i] {
				(*t.maxColumnWidths)[i] = colWidth
			}
		}
	}
	return *t.maxColumnWidths
}
857651
func (s *VideoDescription) SetWidth(v int64) *VideoDescription {
	s.Width = &v
	return s
}
783629
func (s *InsertableImage) SetWidth(v int64) *InsertableImage {
	s.Width = &v
	return s
}
750798
func (c *TableCell) SetMaxWidth(maxWidth int) *TableCell {
	c.MaxWidth = maxWidth
	return c
}