// CorrectWidthHeight changes the cell to have at least the
// minimum width and height
178690
func CorrectWidthHeight(c *chronograf.DashboardCell) {
	if c.W < 1 {
		c.W = DefaultWidth
	}
	if c.H < 1 {
		c.H = DefaultHeight
	}
}
122631
func (s *SubsetFontObj) GlyphIndexToPdfWidth(glyphIndex uint) uint {

	numberOfHMetrics := s.ttfp.NumberOfHMetrics()
	unitsPerEm := s.ttfp.UnitsPerEm()
	if glyphIndex >= numberOfHMetrics {
		glyphIndex = numberOfHMetrics - 1
	}

	width := s.ttfp.Widths()[glyphIndex]
	if unitsPerEm == 1000 {
		return width
	}
	return width * 1000 / unitsPerEm
}
1008747
func PadRight(s, pad string, width int) string {
	gap := width - DisplayWidth(s)
	if gap > 0 {
		return s + strings.Repeat(string(pad), gap)
	}
	return s
}
667744
func (b *Writer) updateWidth() {
	cesc := regexp.MustCompile(`\x1b\[\d+(;\d+)*m`)
	tempStr := b.buf.Bytes()[b.pos:b.buf.Len()]

	b.cell.width += utf8.RuneCount(cesc.ReplaceAll(tempStr, []byte("")))
	b.pos = b.buf.Len()
}
1054663
func (c *Label) GetWidth() int {
	if c.width == -1 {
		if c.bordered {
			return len(c.value) + 2
		}
		return len(c.value)
	}
	return c.width
}
309861
func (gp *GoPdf) SetLineWidth(width float64) {
	gp.curr.lineWidth = gp.UnitsToPoints(width)
	gp.getContent().AppendStreamSetLineWidth(gp.UnitsToPoints(width))
}
65350
func (g *Grid) SizeHint() image.Point {
	if g.cols == 0 || g.rows == 0 {
		return image.Point{}
	}

	var maxWidth int
	for i := 0; i < g.cols; i++ {
		if w := g.columnWidth(i); w > maxWidth {
			maxWidth = w
		}
	}

	var maxHeight int
	for j := 0; j < g.rows; j++ {
		if h := g.rowHeight(j); h > maxHeight {
			maxHeight = h
		}
	}

	width := maxWidth * g.cols
	height := maxHeight * g.rows

	if g.hasBorder {
		width += g.cols + 1
		height += g.rows + 1
	}

	return image.Point{width, height}
}
250082
func (f *Fpdf) GetStringWidth(s string) float64 {
	if f.err != nil {
		return 0
	}
	w := 0
	for _, ch := range []byte(s) {
		if ch == 0 {
			break
		}
		w += f.currentFont.Cw[ch]
	}
	return float64(w) * f.fontSize / 1000
}
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
}
570533
func (b Box) Width() int {
	return util.Math.AbsInt(b.Right - b.Left)
}
283793
func (s *StaticImageActivateScheduleActionSettings) SetWidth(v int64) *StaticImageActivateScheduleActionSettings {
	s.Width = &v
	return s
}
563156
func GetScreenWidth() int {
	info, _ := GetConsoleScreenBufferInfo()
	if info == nil {
		return -1
	}
	return int(info.dwSize.x)
}
84637
func (s *VideoDetail) SetWidthInPx(v int64) *VideoDetail {
	s.WidthInPx = &v
	return s
}
1249540
func (cb *CellBuffer) Resize(w, h int) {

	if cb.h == h && cb.w == w {
		return
	}

	newc := make([]cell, w*h)
	for y := 0; y < h && y < cb.h; y++ {
		for x := 0; x < w && x < cb.w; x++ {
			oc := &cb.cells[(y*cb.w)+x]
			nc := &newc[(y*w)+x]
			nc.currMain = oc.currMain
			nc.currComb = oc.currComb
			nc.currStyle = oc.currStyle
			nc.width = oc.width
			nc.lastMain = rune(0)
		}
	}
	cb.cells = newc
	cb.h = h
	cb.w = w
}
869798
func (s *StaticImageActivateScheduleActionSettings) SetHeight(v int64) *StaticImageActivateScheduleActionSettings {
	s.Height = &v
	return s
}
783629
func (s *InsertableImage) SetWidth(v int64) *InsertableImage {
	s.Width = &v
	return s
}
919452
func (win *Window) LayoutAvailableHeight() int {
	return win.layout.Clip.H - (win.layout.AtY - win.layout.Bounds.Y) - win.style().Spacing.Y - win.layout.Row.Height
}