Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php
public static function getDefaultColumnWidthByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font, $pPixels = false)
    {
        if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) {
            // Exact width can be determined
            $columnWidth = $pPixels ?
                self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px']
                    : self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width'];
        } else {
            // We don't have data for this particular font and size, use approximation by
            // extrapolating from Calibri 11
            $columnWidth = $pPixels ?
                self::$defaultColumnWidths['Calibri'][11]['px']
                    : self::$defaultColumnWidths['Calibri'][11]['width'];
            $columnWidth = $columnWidth * $font->getSize() / 11;

            // Round pixels to closest integer
            if ($pPixels) {
                $columnWidth = (int) round($columnWidth);
            }
        }

        return $columnWidth;
    }
public static function getDefaultColumnWidthByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font, $pPixels = false)
    {
        if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) {
            // Exact width can be determined
            $columnWidth = $pPixels ?
                self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px']
                    : self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width'];
        } else {
            // We don't have data for this particular font and size, use approximation by
            // extrapolating from Calibri 11
            $columnWidth = $pPixels ?
                self::$defaultColumnWidths['Calibri'][11]['px']
                    : self::$defaultColumnWidths['Calibri'][11]['width'];
            $columnWidth = $columnWidth * $font->getSize() / 11;

            // Round pixels to closest integer
            if ($pPixels) {
                $columnWidth = (int) round($columnWidth);
            }
        }

        return $columnWidth;
    }
public static function getDefaultColumnWidthByFont ( \ PhpOffice \ PhpSpreadsheet \ Style \ Font $ font , $ pPixels = false ) { if ( isset ( self :: $ defaultColumnWidths [ $ font -> getName ( ) ] [ $ font -> getSize ( ) ] ) ) { // Exact width can be determined $ columnWidth = $ pPixels ? self :: $ defaultColumnWidths [ $ font -> getName ( ) ] [ $ font -> getSize ( ) ] [ 'px' ] : self :: $ defaultColumnWidths [ $ font -> getName ( ) ] [ $ font -> getSize ( ) ] [ 'width' ] ; } else { // We don't have data for this particular font and size, use approximation by // extrapolating from Calibri 11 $ columnWidth = $ pPixels ? self :: $ defaultColumnWidths [ 'Calibri' ] [ 11 ] [ 'px' ] : self :: $ defaultColumnWidths [ 'Calibri' ] [ 11 ] [ 'width' ] ; $ columnWidth = $ columnWidth * $ font -> getSize ( ) / 11 ; // Round pixels to closest integer if ( $ pPixels ) { $ columnWidth = ( int ) round ( $ columnWidth ) ; } } return $ columnWidth ; }
Get the effective column width for columns without a column dimension or column with width -1
For example, for Calibri 11 this is 9.140625 (64 px).

@param \PhpOffice\PhpSpreadsheet\Style\Font $font The workbooks default font
@param bool $pPixels true = return column width in pixels, false = return in OOXML units

@return mixed Column width
Get the effective column width for columns without a column dimension or column with width - 1 For example for Calibri 11 this is 9 . 140625 ( 64 px ) .