本文整理汇总了PHP中Font_Metrics::_font_lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP Font_Metrics::_font_lookup方法的具体用法?PHP Font_Metrics::_font_lookup怎么用?PHP Font_Metrics::_font_lookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Font_Metrics
的用法示例。
在下文中一共展示了Font_Metrics::_font_lookup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Loads the stored font family cache
*
* @see save_font_families()
*/
static function load_font_families()
{
$dist_fonts = (require_once DOMPDF_DIR . "/lib/fonts/dompdf_font_family_cache.dist.php");
// FIXME: temporary step for font cache created before the font cache fix
if (is_readable(DOMPDF_FONT_DIR . "dompdf_font_family_cache")) {
$old_fonts = (require_once DOMPDF_FONT_DIR . "dompdf_font_family_cache");
// If the font family cache is still in the old format
if ($old_fonts === 1) {
$cache_data = file_get_contents(DOMPDF_FONT_DIR . "dompdf_font_family_cache");
file_put_contents(DOMPDF_FONT_DIR . "dompdf_font_family_cache", "<" . "?php return {$cache_data} ?" . ">");
$old_fonts = (require_once DOMPDF_FONT_DIR . "dompdf_font_family_cache");
}
$dist_fonts += $old_fonts;
}
if (!is_readable(self::CACHE_FILE)) {
self::$_font_lookup = $dist_fonts;
return;
}
self::$_font_lookup = (require_once self::CACHE_FILE);
// If the font family cache is still in the old format
if (self::$_font_lookup === 1) {
$cache_data = file_get_contents(self::CACHE_FILE);
file_put_contents(self::CACHE_FILE, "<" . "?php return {$cache_data} ?" . ">");
self::$_font_lookup = (require_once self::CACHE_FILE);
}
// Merge provided fonts
self::$_font_lookup += $dist_fonts;
}
示例2: elseif
static function load_font_families()
{
//***
if (strtoupper(DOMPDF_PDF_BACKEND) == "CPDF") {
// *** load CPDF fonts
if (!is_readable(self::CACHE_FILE)) {
return;
}
self::$_font_lookup = (require_once self::CACHE_FILE);
// If the font family cache is still in the old format
if (self::$_font_lookup === 1) {
$cache_data = file_get_contents(self::CACHE_FILE);
file_put_contents(self::CACHE_FILE, "<" . "?php return {$cache_data} ?" . ">");
self::$_font_lookup = (require_once self::CACHE_FILE);
}
} elseif (strtoupper(DOMPDF_PDF_BACKEND) == "TCPDF") {
// *** load TCPDF fonts
$fontdir = DOMPDF_LIB_DIR . '/tcpdf/fonts/';
$arfont = array('courier', 'helvetica', 'times', 'almohanad', 'dejavusans', 'dejavusanscondensed', 'dejavusansmono', 'dejavuserif', 'dejavuserifcondensed', 'freesans', 'freeserif', 'freemono');
foreach ($arfont as $fontname) {
if (file_exists($fontdir . $fontname . ".php")) {
self::$_font_lookup[$fontname] = array('normal' => $fontdir . $fontname, 'bold' => $fontdir . $fontname, 'italic' => $fontdir . $fontname, 'bold_italic' => $fontdir . $fontname);
if (file_exists($fontdir . $fontname . "b.php")) {
self::$_font_lookup[$fontname]['bold'] = $fontdir . $fontname . "b";
}
if (file_exists($fontdir . $fontname . "i.php")) {
self::$_font_lookup[$fontname]['italic'] = $fontdir . $fontname . "i";
}
if (file_exists($fontdir . $fontname . "bi.php")) {
self::$_font_lookup[$fontname]['bold_italic'] = $fontdir . $fontname . "bi";
}
}
}
// add the arialunicid0
if (file_exists($fontdir . "arialunicid0.php")) {
self::$_font_lookup['arialunicodems'] = array('normal' => $fontdir . 'arialunicid0', 'bold' => $fontdir . 'arialunicid0', 'italic' => $fontdir . 'arialunicid0', 'bold_italic' => $fontdir . 'arialunicid0');
}
}
}
示例3:
/**
* Loads the stored font family cache
*
* @see save_font_families()
*/
static function load_font_families()
{
if (!is_readable(self::CACHE_FILE)) {
return;
}
self::$_font_lookup = (require_once self::CACHE_FILE);
// If the font family cache is still in the old format
if (self::$_font_lookup === 1) {
$cache_data = file_get_contents(self::CACHE_FILE);
file_put_contents(self::CACHE_FILE, "<" . "?php return {$cache_data} ?" . ">");
self::$_font_lookup = (require_once self::CACHE_FILE);
}
}
示例4: elseif
/**
* Loads the stored font family cache
*
* @see save_font_families()
*/
static function load_font_families()
{
//***
if (strtoupper(DOMPDF_PDF_BACKEND) == "CPDF") {
// *** load CPDF fonts
$dist_fonts = (require_once DOMPDF_DIR . "/lib/fonts/dompdf_font_family_cache.dist.php");
// FIXME: temporary step for font cache created before the font cache fix
if (is_readable(DOMPDF_FONT_DIR . "dompdf_font_family_cache")) {
$old_fonts = (require_once DOMPDF_FONT_DIR . "dompdf_font_family_cache");
// If the font family cache is still in the old format
if ($old_fonts === 1) {
$cache_data = file_get_contents(DOMPDF_FONT_DIR . "dompdf_font_family_cache");
file_put_contents(DOMPDF_FONT_DIR . "dompdf_font_family_cache", "<" . "?php return {$cache_data} ?" . ">");
$old_fonts = (require_once DOMPDF_FONT_DIR . "dompdf_font_family_cache");
}
$dist_fonts += $old_fonts;
}
if (!is_readable(self::CACHE_FILE)) {
self::$_font_lookup = $dist_fonts;
return;
}
self::$_font_lookup = (require_once self::CACHE_FILE);
// If the font family cache is still in the old format
if (self::$_font_lookup === 1) {
$cache_data = file_get_contents(self::CACHE_FILE);
file_put_contents(self::CACHE_FILE, "<" . "?php return {$cache_data} ?" . ">");
self::$_font_lookup = (require_once self::CACHE_FILE);
}
// Merge provided fonts
self::$_font_lookup += $dist_fonts;
} elseif (strtoupper(DOMPDF_PDF_BACKEND) == "TCPDF") {
// *** load TCPDF fonts
$fontdir = DOMPDF_LIB_DIR . '/tcpdf/fonts/';
$arfont = array('courier', 'helvetica', 'times', 'almohanad', 'freesans', 'freeserif', 'freemono');
foreach ($arfont as $fontname) {
if (file_exists($fontdir . $fontname . ".php")) {
self::$_font_lookup[$fontname] = array('normal' => $fontdir . $fontname, 'bold' => $fontdir . $fontname, 'italic' => $fontdir . $fontname, 'bold_italic' => $fontdir . $fontname);
if (file_exists($fontdir . $fontname . "b.php")) {
self::$_font_lookup[$fontname]['bold'] = $fontdir . $fontname . "b";
}
if (file_exists($fontdir . $fontname . "i.php")) {
self::$_font_lookup[$fontname]['italic'] = $fontdir . $fontname . "i";
}
if (file_exists($fontdir . $fontname . "bi.php")) {
self::$_font_lookup[$fontname]['bold_italic'] = $fontdir . $fontname . "bi";
}
}
}
// add the arialunicid0
if (file_exists($fontdir . "arialunicid0.php")) {
self::$_font_lookup['arialunicodems'] = array('normal' => $fontdir . 'arialunicid0', 'bold' => $fontdir . 'arialunicid0', 'italic' => $fontdir . 'arialunicid0', 'bold_italic' => $fontdir . 'arialunicid0');
}
}
}