Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
|
Static Public Member Functions | |
static | calculateColumnWidth (FontStyle $font, $cellText='', int $rotation=0, ?FontStyle $defaultFont=null, bool $filterAdjustment=false, int $indentAdjustment=0) |
Calculate an (approximate) OpenXML column width, based on font size and text contained. | |
static | centimeterSizeToPixels (int|float $sizeInCm) |
Calculate an (approximate) pixel size, based on centimeter size. | |
static | fontSizeToPixels (float|int $fontSizeInPoints) |
Calculate an (approximate) pixel size, based on a font points size. | |
static | getAutoSizeMethod () |
Get autoSize method. | |
static | getCharsetFromFontName (string $fontName) |
Returns the associated charset for the font name. | |
static | getDefaultColumnWidthByFont (FontStyle $font, bool $returnAsPixels=false) |
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). | |
static | getDefaultRowHeightByFont (FontStyle $font) |
Get the effective row height for rows without a row dimension or rows with height -1 For example, for Calibri 11 this is 15 points. | |
static | getPaddingAmountExact () |
Get pad amount for exact in pixels; or null if using best guess. | |
static | getTextWidthPixelsApprox (string $columnText, FontStyle $font, int $rotation=0) |
Get approximate width in pixels for a string of text in a certain font at a certain rotation angle. | |
static | getTextWidthPixelsExact (string $text, FontStyle $font, int $rotation=0) |
Get GD text width in pixels for a string of text in a certain font at a certain rotation angle. | |
static | getTrueTypeFontFileFromFont (FontStyle $font, bool $checkPath=true) |
Returns the font path given the font. | |
static | getTrueTypeFontPath () |
Get the path to the folder containing .ttf files. | |
static | inchSizeToPixels (int|float $sizeInInch) |
Calculate an (approximate) pixel size, based on inch size. | |
static static | setAutoSizeMethod (string $method) |
Set autoSize method. | |
static | setPaddingAmountExact (null|float|int $paddingAmountExact) |
Set pad amount for exact in pixels; use best guess if null. | |
static | setTrueTypeFontPath (string $folderPath) |
Set the path to the folder containing .ttf files. | |
Public Attributes | |
const | ARIAL = 'arial.ttf' |
Font filenames. | |
const | ARIAL_BOLD = 'arialbd.ttf' |
const | ARIAL_BOLD_ITALIC = 'arialbi.ttf' |
const | ARIAL_ITALIC = 'ariali.ttf' |
const | AUTOSIZE_METHOD_APPROX = 'approx' |
const | AUTOSIZE_METHOD_EXACT = 'exact' |
const | CALIBRI = 'calibri.ttf' |
const | CALIBRI_BOLD = 'calibrib.ttf' |
const | CALIBRI_BOLD_ITALIC = 'calibriz.ttf' |
const | CALIBRI_ITALIC = 'calibrii.ttf' |
const | CHARSET_ANSI_ARABIC = 0xB2 |
const | CHARSET_ANSI_BALTIC = 0xBA |
const | CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86 |
const | CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88 |
const | CHARSET_ANSI_CYRILLIC = 0xCC |
const | CHARSET_ANSI_GREEK = 0xA1 |
const | CHARSET_ANSI_HEBREW = 0xB1 |
const | CHARSET_ANSI_JAPANESE_SHIFTJIS = 0x80 |
const | CHARSET_ANSI_KOREAN_HANGUL = 0x81 |
const | CHARSET_ANSI_KOREAN_JOHAB = 0x82 |
file home runner work phpdoc phpdoc moodle lib phpspreadsheet phpspreadsheet src PhpSpreadsheet Shared Font php const | CHARSET_ANSI_LATIN = 0x00 |
Character set codes used by BIFF5-8 in Font records. | |
const | CHARSET_ANSI_LATIN_II = 0xEE |
const | CHARSET_ANSI_THAI = 0xDD |
const | CHARSET_ANSI_TURKISH = 0xA2 |
const | CHARSET_ANSI_VIETNAMESE = 0xA3 |
const | CHARSET_APPLE_ROMAN = 0x4D |
const | CHARSET_FROM_FONT_NAME |
const | CHARSET_OEM_LATIN_I = 0xFF |
const | CHARSET_SYMBOL = 0x02 |
const | CHARSET_SYSTEM_DEFAULT = 0x01 |
const | COMIC_SANS_MS = 'comic.ttf' |
const | COMIC_SANS_MS_BOLD = 'comicbd.ttf' |
const | COURIER_NEW = 'cour.ttf' |
const | COURIER_NEW_BOLD = 'courbd.ttf' |
const | COURIER_NEW_BOLD_ITALIC = 'courbi.ttf' |
const | COURIER_NEW_ITALIC = 'couri.ttf' |
const | FONT_FILE_NAMES |
const | GEORGIA = 'georgia.ttf' |
const | GEORGIA_BOLD = 'georgiab.ttf' |
const | GEORGIA_BOLD_ITALIC = 'georgiaz.ttf' |
const | GEORGIA_ITALIC = 'georgiai.ttf' |
const | IMPACT = 'impact.ttf' |
const | LIBERATION_SANS = 'LiberationSans-Regular.ttf' |
const | LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf' |
const | LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf' |
const | LIBERATION_SANS_ITALIC = 'LiberationSans-Italic.ttf' |
const | LUCIDA_CONSOLE = 'lucon.ttf' |
const | LUCIDA_SANS_UNICODE = 'l_10646.ttf' |
const | MICROSOFT_SANS_SERIF = 'micross.ttf' |
const | PALATINO_LINOTYPE = 'pala.ttf' |
const | PALATINO_LINOTYPE_BOLD = 'palab.ttf' |
const | PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf' |
const | PALATINO_LINOTYPE_ITALIC = 'palai.ttf' |
const | SYMBOL = 'symbol.ttf' |
const | TAHOMA = 'tahoma.ttf' |
const | TAHOMA_BOLD = 'tahomabd.ttf' |
const | TIMES_NEW_ROMAN = 'times.ttf' |
const | TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf' |
const | TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf' |
const | TIMES_NEW_ROMAN_ITALIC = 'timesi.ttf' |
const | TREBUCHET_MS = 'trebuc.ttf' |
const | TREBUCHET_MS_BOLD = 'trebucbd.ttf' |
const | TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf' |
const | TREBUCHET_MS_ITALIC = 'trebucit.ttf' |
const | VERDANA = 'verdana.ttf' |
const | VERDANA_BOLD = 'verdanab.ttf' |
const | VERDANA_BOLD_ITALIC = 'verdanaz.ttf' |
const | VERDANA_ITALIC = 'verdanai.ttf' |
|
static |
Calculate an (approximate) OpenXML column width, based on font size and text contained.
FontStyle | $font | Font object |
null | RichText | string | $cellText | Text to calculate width |
int | $rotation | Rotation angle |
null | FontStyle | $defaultFont | Font object |
bool | $filterAdjustment | Add space for Autofilter or Table dropdown |
|
static |
Calculate an (approximate) pixel size, based on centimeter size.
float | int | $sizeInCm | Font size (in centimeters) |
float | Size (in pixels) |
|
static |
Calculate an (approximate) pixel size, based on a font points size.
float | int | $fontSizeInPoints | Font size (in points) |
int | Font size (in pixels) |
|
static |
Returns the associated charset for the font name.
string | $fontName | Font name |
int | Character set code |
|
static |
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).
FontStyle | $font | The workbooks default font |
bool | $returnAsPixels | true = return column width in pixels, false = return in OOXML units |
($returnAsPixels | is true ? int : float) Column width |
|
static |
Get the effective row height for rows without a row dimension or rows with height -1 For example, for Calibri 11 this is 15 points.
FontStyle | $font | The workbooks default font |
float | Row height in points |
|
static |
Get approximate width in pixels for a string of text in a certain font at a certain rotation angle.
int | Text width in pixels (no padding added) |
|
static |
Returns the font path given the font.
string | Path to TrueType font file |
|
static |
Calculate an (approximate) pixel size, based on inch size.
float | int | $sizeInInch | Font size (in inch) |
float|int | Size (in pixels) |
|
static |
Set autoSize method.
string | $method | see self::AUTOSIZE_METHOD_* |
bool | Success or failure |
|
static |
Set the path to the folder containing .ttf files.
There should be a trailing slash. Path will be recursively searched for font file. Typical locations on various platforms:
.
const PhpOffice\PhpSpreadsheet\Shared\Font::CHARSET_FROM_FONT_NAME |