/** * 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; }
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'); } } }
/** * 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); } }
/** * 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'); } } }