本文整理汇总了PHP中find_best_location_in_include_path函数的典型用法代码示例。如果您正苦于以下问题:PHP find_best_location_in_include_path函数的具体用法?PHP find_best_location_in_include_path怎么用?PHP find_best_location_in_include_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_best_location_in_include_path函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_admin_password
/**
* Function save_admin_password
*
* Writes new admin password to the admin config.php
*/
function save_admin_password($password1, $password2, $language)
{
global $g_language;
if ( $language )
$g_language = $language;
if ( $password1 != $password2 )
return sw_translate("The passwords are not identical please reenter");
if ( strlen($password1) == 0 )
return sw_translate("The password may not be blank");
$proj_parent = find_best_location_in_include_path( $this->admin_projects_folder);
$proj_dir = $proj_parent."/admin";
$proj_conf = $proj_dir."/config.php";
$proj_template = $proj_dir."/adminconfig.template";
if ( !file_exists ( $proj_parent ) )
return "Projects area $proj_parent does not exist - cannot write project";
if ( file_exists ( $proj_conf ) )
{
if ( !is_writeable ( $proj_conf ) )
return "Projects config file $proj_conf is not writeable - cannot write config file - change permissions to continue";
}
if ( !is_writeable ( $proj_dir ) )
return "Projects area $proj_dir is not writeable - cannot write project password in config.php - change permissions to continue";
if ( !file_exists ( $proj_conf ) )
if ( !file_exists ( $proj_template ) )
return "Projects config template file $proj_template does not exist - please contact reportico.org";
if ( file_exists ( $proj_conf ) )
{
$txt = file_get_contents($proj_conf);
}
else
{
$txt = file_get_contents($proj_template);
}
$proj_language = find_best_location_in_include_path( "language" ) ;
$lang_dir = $proj_language."/".$language;
if ( !is_dir ( $lang_dir ) )
return "Language directory $language does not exist within the language folder";
$txt = preg_replace ( "/(define.*?SW_ADMIN_PASSWORD',).*\);/", "$1'$password1');", $txt);
$txt = preg_replace ( "/(define.*?SW_LANGUAGE',).*\);/", "$1'$language');", $txt);
unset_reportico_session_param('admin_password');
$retval = file_put_contents($proj_conf, $txt );
// Password is saved so use it so user can login
if ( !defined('SW_ADMIN_PASSWORD') )
define ('SW_ADMIN_PASSWORD', $password1);
else
define ('SW_ADMIN_PASSWORD_RESET', $password1);
return ;
}
示例2: error_reporting
* @copyright 2010-2014 Peter Deed
* @author Peter Deed <info@reportico.org>
* @package Reportico
* @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* @version $Id: swgraph_nvd3.php,v 1.3 2014/05/17 15:12:31 peter Exp $
*/
error_reporting(E_ALL);
if (function_exists("imagecreatefromstring")) {
//include("pChart/class/pData.class.php");
//include("pChart/class/pDraw.class.php");
//include("pChart/class/pImage.class.php");
//include("pChart/class/pPie.class.php");
include "pChart/pChart.class";
include "pChart/pData.class";
include "pChart/pCache.class";
$fontpath = find_best_location_in_include_path("pChart/fonts");
define("PCHARTFONTS_DIR", $fontpath . "/");
} else {
echo "GD not installed ( imagecreatefromstring function does not exist )";
die;
}
require_once 'swutil.php';
/**
* Class reportico_graph
*
* Storage and generation of report graphs. Holds
* everything necessary such as titles, axis formatting,
* graph type, colours etc
*/
class reportico_graph
{
示例3: _putfonts
function _putfonts()
{
$nf = $this->n;
foreach ($this->diffs as $diff) {
//Encodings
$this->_newobj();
$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
$this->_out('endobj');
}
$mqr = get_magic_quotes_runtime();
ini_set('magic_quotes_runtime', 0);
foreach ($this->FontFiles as $file => $info) {
//Font file embedding
$this->_newobj();
$this->FontFiles[$file]['n'] = $this->n;
if (defined('FPDF_FONTPATH')) {
$file = FPDF_FONTPATH . $file;
}
$ofile = $file;
if (!is_file($file)) {
$file = find_best_location_in_include_path($file);
if (!$file) {
$file = $ofile;
}
}
$size = filesize($file);
if (!$size) {
$this->Error('Font file not found');
}
$this->_out('<</Length ' . $size);
if (substr($file, -2) == '.z') {
$this->_out('/Filter /FlateDecode');
}
$this->_out('/Length1 ' . $info['length1']);
if (isset($info['length2'])) {
$this->_out('/Length2 ' . $info['length2'] . ' /Length3 0');
}
$this->_out('>>');
$f = fopen($file, 'rb');
$this->_putstream(fread($f, $size));
fclose($f);
$this->_out('endobj');
}
ini_set('magic_quotes_runtime', $mqr);
foreach ($this->fonts as $k => $font) {
//Font objects
$this->fonts[$k]['n'] = $this->n + 1;
$type = $font['type'];
$name = $font['name'];
if ($type == 'core') {
//Standard font
$this->_newobj();
$this->_out('<</Type /Font');
$this->_out('/BaseFont /' . $name);
$this->_out('/Subtype /Type1');
if ($name != 'Symbol' and $name != 'ZapfDingbats') {
$this->_out('/Encoding /WinAnsiEncoding');
}
$this->_out('>>');
$this->_out('endobj');
} elseif ($type == 'Type1' or $type == 'TrueType') {
//Additional Type1 or TrueType font
$this->_newobj();
$this->_out('<</Type /Font');
$this->_out('/BaseFont /' . $name);
$this->_out('/Subtype /' . $type);
$this->_out('/FirstChar 32 /LastChar 255');
$this->_out('/Widths ' . ($this->n + 1) . ' 0 R');
$this->_out('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
if ($font['enc']) {
if (isset($font['diff'])) {
$this->_out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
} else {
$this->_out('/Encoding /WinAnsiEncoding');
}
}
$this->_out('>>');
$this->_out('endobj');
//Widths
$this->_newobj();
$cw =& $font['cw'];
$s = '[';
for ($i = 32; $i <= 255; $i++) {
$s .= $cw[chr($i)] . ' ';
}
$this->_out($s . ']');
$this->_out('endobj');
//Descriptor
$this->_newobj();
$s = '<</Type /FontDescriptor /FontName /' . $name;
foreach ($font['desc'] as $k => $v) {
$s .= ' /' . $k . ' ' . $v;
}
$file = $font['file'];
if ($file) {
$s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->FontFiles[$file]['n'] . ' 0 R';
}
$this->_out($s . '>>');
$this->_out('endobj');
} else {
//.........这里部分代码省略.........
示例4: generate_dropdown_menu
/**
* Function generate_dropdown_menu
*
* Writes new admin password to the admin config.php
*/
function generate_dropdown_menu(&$menu)
{
foreach ($menu as $k => $v) {
$project = $v["project"];
$projtitle = "<AUTO>";
if (isset($v["title"])) {
$projtitle = $v["title"];
}
$menu[$k]["title"] = sw_translate($projtitle);
foreach ($v["items"] as $k1 => $menuitem) {
if (!isset($menuitem["reportname"]) || $menuitem["reportname"] == "<AUTO>") {
// Generate Menu from XML files
global $g_projpath;
$proj_parent = find_best_location_in_include_path("projects");
$filename = $proj_parent . "/" . $project . "/" . $menuitem["reportfile"];
if (!preg_match("/\\.xml/", $filename)) {
$filename .= ".xml";
}
if (is_file($filename)) {
$query = false;
$repxml = new reportico_xml_reader($query, $filename, false, "ReportTitle");
$menu[$k]["items"][$k1]["reportname"] = sw_translate($repxml->search_response);
}
}
}
}
}
示例5: load_plugins
function load_plugins()
{
$plugin_dir = find_best_location_in_include_path("plugins");
if (is_dir($plugin_dir)) {
if ($dh = opendir($plugin_dir)) {
while (($file = readdir($dh)) !== false) {
$plugin = $plugin_dir . "/" . $file;
if (is_dir($plugin)) {
$plugin_file = $plugin . "/global.php";
if (is_file($plugin_file)) {
require_once $plugin_file;
}
$plugin_file = $plugin . "/" . strtolower($this->execute_mode) . ".php";
if (is_file($plugin_file)) {
require_once $plugin_file;
}
}
}
}
}
// Call any plugin initialisation
$this->apply_plugins("initialize", $this);
}
示例6: start
function start()
{
reportico_report::start();
$this->debug("PDF Start **");
// Set default page size, margins, fonts etc
$this->page_line_count = 0;
$this->fontName = $this->query->get_attribute("pdfFont");
$this->fontSize = $this->query->get_attribute("pdfFontSize");
$this->vsize = $this->fontSize + $this->vspace;
$this->orientation = $this->query->get_attribute("PageOrientation");
$this->page_type = $this->query->get_attribute("PageSize");
if ($this->orientation == "Portrait") {
$this->abs_page_width = $this->page_types[$this->page_type]["width"];
$this->abs_page_height = $this->page_types[$this->page_type]["height"];
} else {
$this->abs_page_width = $this->page_types[$this->page_type]["height"];
$this->abs_page_height = $this->page_types[$this->page_type]["width"];
}
$this->abs_top_margin = $this->abs_paging_height($this->query->get_attribute("TopMargin"));
$this->abs_bottom_margin = $this->abs_page_height - $this->abs_paging_height($this->query->get_attribute("BottomMargin"));
$this->abs_right_margin = $this->abs_page_width - $this->abs_paging_width($this->query->get_attribute("RightMargin"));
$this->abs_left_margin = $this->abs_paging_width($this->query->get_attribute("LeftMargin"));
$this->abs_print_width = $this->abs_right_margin - $this->abs_left_margin;
$this->abs_row_left_margin = $this->abs_left_margin;
$this->abs_col_left_margin = $this->abs_left_margin;
$this->abs_row_right_margin = $this->abs_right_margin;
$this->abs_col_right_margin = $this->abs_right_margin;
$this->abs_row_width = $this->abs_print_width;
$this->abs_columns_width = $this->abs_print_width;
// Set up default styles
$this->stylestack = array("border-width" => array(0 => false), "border-edges" => array(0 => ""), "padding" => array(0 => false), "border-style" => array(0 => "none"), "border-color" => array(0 => "#000000"), "font-family" => array(0 => $this->fontName), "font-size" => array(0 => $this->fontSize), "font-weight" => array(0 => false), "font-style" => array(0 => false), "color" => array(0 => "#000000"), "background-color" => array(0 => array(255, 255, 255)), "isfilling" => array(0 => false), "padding" => array(0 => 0), "margin" => array(0 => array(0, 0, 0, 0)), "margin-left" => array(0 => 0), "margin-right" => array(0 => 0), "margin-top" => array(0 => 0), "margin-bottom" => array(0 => 0), "text-align" => array(0 => false), "position" => array(0 => "relative"), "height" => array(0 => false), "width" => array(0 => false), "background-image" => array(0 => false), "type" => array(0 => "BASE"));
if ($this->pdfDriver == "tcpdf") {
// If font used is a Unicode Truetype font then
// use Unicode PDF generator
$pdf_path = find_best_location_in_include_path("tcpdf");
require_once $pdf_path . "/tcpdf.php";
//require_once($pdf_path."/tcpdf.php");
$this->document = new TCPDF($this->orientations[$this->orientation], 'pt', $this->page_type, true, 'UTF-8', false);
$this->document->setPrintHeader(false);
//if ( !isset($this->document->CoreFonts[strtolower($this->fontName)]) )
//if ( !isset ($this->document->fonts[strtolower($this->fontName)] ) )
//$this->document->AddFont($this->fontName, '', $this->fontName.'.php');
// If the font loaded is a TrueTypeUnicode font, then we wnat to
// use UniCode PDF generator instead
// if ( $this->document->FontType == "TrueTypeUnicode" )
// {
// $this->document = new UFPDF($this->orientations[$this->orientation],'pt',$this->page_type);
// if ( !isset($this->document->CoreFonts[strtolower($this->fontName)]) )
// if ( !isset ($this->document->fonts[strtolower($this->fontName)] ) )
// $this->document->AddFont($this->fontName, '', $this->fontName.'.php');
// }
} else {
$pdf_path = find_best_location_in_include_path("fpdf");
require_once $pdf_path . "/fpdf.php";
require_once $pdf_path . "/ufpdf.php";
$this->document = new FPDF($this->orientations[$this->orientation], 'pt', $this->page_type);
if (!isset($this->document->CoreFonts[strtolower($this->fontName)])) {
if (!isset($this->document->fonts[strtolower($this->fontName)])) {
$this->document->AddFont($this->fontName, '', $this->fontName . '.php');
}
}
// If the font loaded is a TrueTypeUnicode font, then we wnat to
// use UniCode PDF generator instead
if ($this->document->FontType == "TrueTypeUnicode") {
$this->document = new UFPDF($this->orientations[$this->orientation], 'pt', $this->page_type);
if (!isset($this->document->CoreFonts[strtolower($this->fontName)])) {
if (!isset($this->document->fonts[strtolower($this->fontName)])) {
$this->document->AddFont($this->fontName, '', $this->fontName . '.php');
}
}
}
}
$this->document->SetAutoPageBreak(false);
$this->document->SetMargins(0, 0, 0);
$this->document->SetCreator('Reportico');
$this->document->SetAuthor('Reportico');
$this->document->SetTitle($this->reporttitle);
//$this->calculateColumnMetrics();
}
示例7: reportico_datasource
$g_debug_mode = true;
$test = new reportico_datasource();
$test->driver = $type;
$test->user_name = $user;
$test->password = $password;
$test->host_name = $host;
$test->database = $name;
$test->server = $server;
$test->protocol = $protocol;
$test->connect(true);
if ($test->connected) {
handle_debug("Connection to Database succeeded", 0);
} else {
trigger_error("Connection to Database failed");
}
$proj_parent = find_best_location_in_include_path("projects");
$proj_dir = $proj_parent . "/{$project}";
$proj_conf = $proj_dir . "/config.php";
$proj_menu = $proj_dir . "/menu.php";
$proj_lang = $proj_dir . "/lang.php";
$proj_template = $proj_parent . "/admin/config.template";
$menu_template = $proj_parent . "/admin/menu.template";
$lang_template = $proj_parent . "/admin/lang.template";
if (!file_exists($proj_parent)) {
trigger_error("Projects area {$proj_parent} does not exist - cannot write project");
return;
}
if (!is_writeable($proj_parent)) {
trigger_error("Projects area {$proj_parent} is not writeable - cannot write project");
return;
}
示例8: available_languages
function available_languages()
{
$langs = array();
global $g_language;
$lang_dir = find_best_location_in_include_path("language");
if (is_dir($lang_dir)) {
// Place english at the start
if ($dh = opendir($lang_dir)) {
while (($file = readdir($dh)) !== false) {
if ($file == "en_gb" || $file == "en_us") {
if (is_dir($lang_dir . "/" . $file)) {
$langs[] = array("label" => template_xlate($file), "value" => $file, "active" => $file == $g_language);
}
}
}
closedir($dh);
}
if ($dh = opendir($lang_dir)) {
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != ".." && $file != "CVS" && $file != "packs" && $file != "en_us" && $file != "en_gb") {
if (is_dir($lang_dir . "/" . $file)) {
$langs[] = array("label" => template_xlate($file), "value" => $file, "active" => $file == $g_language);
}
}
}
closedir($dh);
}
}
// No languages found at all - default to en_gb
if (count($langs) == 0) {
$langs[] = array("label" => template_xlate("en_gb"), "value" => "en_gb");
}
return $langs;
}
示例9: start
function start()
{
reportico_report::start();
$this->debug("PDF Start **");
// Set default page size, margins, fonts etc
$this->page_line_count = 0;
$this->fontName = $this->query->get_attribute("pdfFont");
$this->fontSize = $this->query->get_attribute("pdfFontSize");
$this->vsize = $this->fontSize + $this->vspace;
$this->orientation = $this->query->get_attribute("PageOrientation");
$this->page_type = $this->query->get_attribute("PageSize");
if ($this->orientation == "Portrait") {
$this->abs_page_width = $this->page_types[$this->page_type]["width"];
$this->abs_page_height = $this->page_types[$this->page_type]["height"];
} else {
$this->abs_page_width = $this->page_types[$this->page_type]["height"];
$this->abs_page_height = $this->page_types[$this->page_type]["width"];
}
$this->abs_top_margin = $this->abs_paging_height($this->query->get_attribute("TopMargin"));
$this->abs_bottom_margin = $this->abs_page_height - $this->abs_paging_height($this->query->get_attribute("BottomMargin"));
$this->abs_right_margin = $this->abs_page_width - $this->abs_paging_width($this->query->get_attribute("RightMargin"));
$this->abs_left_margin = $this->abs_paging_width($this->query->get_attribute("LeftMargin"));
// Set up default styles
$this->stylestack = array("border-width" => array(0 => ""), "padding" => array(0 => false), "border-style" => array(0 => "none"), "border-color" => array(0 => "#000000"), "font-size" => array(0 => $this->fontSize), "color" => array(0 => "#000000"), "background-color" => array(0 => array(255, 255, 255)), "isfilling" => array(0 => false), "padding" => array(0 => 0));
// If font used is a Unicode Truetype font then
// use Unicode PDF generator
$pdf_path = find_best_location_in_include_path("fpdf");
require_once $pdf_path . "/fpdf.php";
require_once $pdf_path . "/ufpdf.php";
$this->document = new FPDF($this->orientations[$this->orientation], 'pt', $this->page_type);
if (!isset($this->document->CoreFonts[strtolower($this->fontName)])) {
if (!isset($this->document->fonts[strtolower($this->fontName)])) {
$this->document->AddFont($this->fontName, '', $this->fontName . '.php');
}
}
// If the font loaded is a TrueTypeUnicode font, then we wnat to
// use UniCode PDF generator instead
if ($this->document->FontType == "TrueTypeUnicode") {
$this->document = new UFPDF($this->orientations[$this->orientation], 'pt', $this->page_type);
if (!isset($this->document->CoreFonts[strtolower($this->fontName)])) {
if (!isset($this->document->fonts[strtolower($this->fontName)])) {
$this->document->AddFont($this->fontName, '', $this->fontName . '.php');
}
}
}
$this->document->SetAutoPageBreak(false);
$this->document->SetMargins(0, 0, 0);
$this->document->SetCreator('Reportico');
$this->document->SetAuthor('Reportico');
$this->document->SetTitle($this->reporttitle);
// Calculate column print and width poistions based on the column start attributes
$looping = true;
foreach ($this->query->display_order_set["column"] as $k => $w) {
$col = get_query_column($w->query_name, $this->query->columns);
$startcol = $col->attributes["ColumnStartPDF"];
$colwidth = $col->attributes["ColumnWidthPDF"];
if ($startcol) {
$col->abs_column_start = $this->abs_paging_width($startcol);
} else {
$col->abs_column_start = 0;
}
if ($colwidth) {
$col->abs_column_width = $this->abs_paging_width($colwidth);
} else {
$col->abs_column_width = 0;
}
}
while ($looping) {
$fromkey = 0;
$nextkey = 0;
$frompos = 0;
$nextpos = 0;
$topos = 0;
$lastwidth = 0;
$looping = false;
$gapct = 0;
$k = 0;
$colct = count($this->query->display_order_set["column"]);
$coltaken = 0;
$colstocalc = 0;
$colswithwidth = 0;
foreach ($this->query->display_order_set["column"] as $k => $w) {
if ($w->attributes["column_display"] != "show") {
continue;
}
$col = get_query_column($w->query_name, $this->query->columns);
$startcol = $col->abs_column_start;
$colwidth = $col->abs_column_width;
if ($startcol) {
if ($frompos && $gapct) {
$topos = $col->abs_column_start;
break;
} else {
$fromkey = $k;
$tokey = $k;
$frompos = $col->abs_column_start;
if ($colwidth) {
$coltaken += $colwidth;
$coltaken = 0;
$colswithwidth = 1;
//.........这里部分代码省略.........
示例10: trigger_error
trigger_error("Connection to Database failed");
return;
}
}
}
} else {
$configparams["SW_PROJECT"] = SW_PROJECT;
$configparams["SW_PROJECT_TITLE"] = SW_PROJECT_TITLE;
}
$proj_parent = $this->projects_folder;
if (!is_dir($proj_parent)) {
$proj_parent = find_best_location_in_include_path($this->projects_folder);
}
$admin_folder = $this->admin_projects_folder;
if (!is_dir($admin_folder)) {
$admin_folder = find_best_location_in_include_path($this->admin_projects_folder);
}
$proj_dir = $proj_parent . "/" . $configparams["SW_PROJECT"];
$proj_conf = $proj_dir . "/config.php";
$proj_menu = $proj_dir . "/menu.php";
$proj_lang = $proj_dir . "/lang.php";
$proj_template = $admin_folder . "/admin/config.template";
$menu_template = $admin_folder . "/admin/menu.template";
$lang_template = $admin_folder . "/admin/lang.template";
if (!file_exists($proj_parent)) {
trigger_error("Projects area {$proj_parent} does not exist - cannot write project");
return;
}
if (!is_writeable($proj_parent)) {
if ($_configure_mode == "DELETE") {
trigger_error("Projects area {$proj_parent} is not writeable - cannot delete project");
示例11: prepare_wsdl_data
function prepare_wsdl_data($savefile = false)
{
$smarty = new smarty();
$smarty->compile_dir = find_best_location_in_include_path("templates_c");
$smarty->assign('WS_SERVICE_NAMESPACE', SW_SOAP_NAMESPACE);
$smarty->assign('WS_SERVICE_CODE', SW_SOAP_SERVICECODE);
$smarty->assign('WS_SERVICE_NAME', SW_SOAP_SERVICENAME);
$smarty->assign('WS_SERVICE_URL', SW_SOAP_SERVICEURL);
$smarty->debugging = true;
$cols = array();
$cols[] = array("name" => "ReportName", "type" => "char", "length" => 0);
foreach ($this->query->columns as $col) {
$cols[] = array("name" => $col->query_name, "type" => $col->column_type, "length" => $col->column_length);
}
$smarty->assign("COLUMN_ITEMS", $cols);
$crits = array();
foreach ($this->query->lookup_queries as $lq) {
$crits[] = array("name" => $lq->query_name);
}
$smarty->assign("CRITERIA_ITEMS", $crits);
header('Content-Type: text/xml');
if ($savefile) {
$data = $smarty->fetch('wsdl.tpl', null, null, false);
$this->write_report_file($savefile, $data);
} else {
$smarty->display('wsdl.tpl');
}
}
示例12: perform_project_modifications
function perform_project_modifications($project)
{
$filename = find_best_location_in_include_path("projects/" . $project . "/modification_rules.php");
$return_status = array("errstat" => 0, "msgtext" => "Modification sucessful");
if (is_file($filename)) {
require_once $filename;
custom_project_modifications(&$this, $return_status);
} else {
$return_status["errstat"] = -1;
$return_status["msgtext"] = "No modifcation rules were found";
}
return $return_status;
}
示例13: _puttruetypeunicode
function _puttruetypeunicode($font)
{
//Type0 Font
$this->_newobj();
$this->_out('<</Type /Font');
$this->_out('/Subtype /Type0');
$this->_out('/BaseFont /' . $font['name'] . '-UCS');
$this->_out('/Encoding /Identity-H');
$this->_out('/DescendantFonts [' . ($this->n + 1) . ' 0 R]');
$this->_out('>>');
$this->_out('endobj');
//CIDFont
$this->_newobj();
$this->_out('<</Type /Font');
$this->_out('/Subtype /CIDFontType2');
$this->_out('/BaseFont /' . $font['name']);
$this->_out('/CIDSystemInfo <</Registry (Adobe) /Ordering (UCS) /Supplement 0>>');
$this->_out('/FontDescriptor ' . ($this->n + 1) . ' 0 R');
$c = 0;
$widths = false;
foreach ($font['cw'] as $i => $w) {
$widths .= $i . ' [' . $w . '] ';
}
$this->_out('/W [' . $widths . ']');
$this->_out('/CIDToGIDMap ' . ($this->n + 2) . ' 0 R');
$this->_out('>>');
$this->_out('endobj');
//Font descriptor
$this->_newobj();
$this->_out('<</Type /FontDescriptor');
$this->_out('/FontName /' . $font['name']);
$s = false;
foreach ($font['desc'] as $k => $v) {
$s .= ' /' . $k . ' ' . $v;
}
if ($font['file']) {
$s .= ' /FontFile2 ' . $this->FontFiles[$font['file']]['n'] . ' 0 R';
}
$this->_out($s);
$this->_out('>>');
$this->_out('endobj');
//Embed CIDToGIDMap
$this->_newobj();
if (defined('FPDF_FONTPATH')) {
$file = FPDF_FONTPATH . $font['ctg'];
} else {
$file = $font['ctg'];
}
$ofile = $file;
if (!is_file($file)) {
$file = find_best_location_in_include_path($file);
if (!$file) {
$file = $ofile;
}
}
$size = filesize($file);
if (!$size) {
$this->Error('Font file not found');
}
$this->_out('<</Length ' . $size);
if (substr($file, -2) == '.z') {
$this->_out('/Filter /FlateDecode');
}
$this->_out('>>');
$f = fopen($file, 'rb');
$this->_putstream(fread($f, $size));
fclose($f);
$this->_out('endobj');
}