本文整理汇总了PHP中Font类的典型用法代码示例。如果您正苦于以下问题:PHP Font类的具体用法?PHP Font怎么用?PHP Font使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Font类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: readString
private function readString($name)
{
$font = $this->font;
$size = $font->readUInt16();
$this->data["{$name}Size"] = $size;
$this->data[$name] = Font::UTF16ToUTF8($font->read($size));
}
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:7,代码来源:Font_EOT_Header.php
示例2: __construct
function __construct(Boundary $bound, $text = NULL, Font $font = NULL, Color $color = NULL, $align = self::ALIGN_LEFT_TOP)
{
parent::__construct($bound, $color);
$this->text($text) or $this->text = '';
$this->font($font) or $this->font = Font::getDefault();
$this->align($align) or $this->align = self::ALIGN_LEFT_TOP;
}
开发者ID:shevtsov-s,项目名称:planetsbook,代码行数:7,代码来源:GDGraphicalObjects.php
示例3: __construct
function __construct($bounds)
{
$this->bound = Boundary::copyOrDefault($bounds);
$this->title = ['text' => 'Диаграмма', 'color' => Color::getDefault(), 'font' => Font::getDefault(), 'margin' => ['top' => 10, 'bottom' => 10]];
$this->values = ['bgcolors' => [Color::getDefault()], 'fgcolors' => [Color::getDefault()], 'font' => Font::getDefault(), 'labels' => TRUE];
$this->bgcolor = new Color(255, 255, 255);
}
开发者ID:shevtsov-s,项目名称:planetsbook,代码行数:7,代码来源:Chart.php
示例4: _parse
protected function _parse()
{
$font = $this->getFont();
$data = array();
$tableOffset = $font->pos();
$data = $font->unpack(self::$header_format);
$records = array();
for ($i = 0; $i < $data["count"]; $i++) {
$record = new Font_Table_name_Record();
$record_data = $font->unpack(Font_Table_name_Record::$format);
$record->map($record_data);
$records[] = $record;
}
$names = array();
foreach ($records as $record) {
$font->seek($tableOffset + $data["stringOffset"] + $record->offset);
$s = $font->read($record->length);
$record->string = Font::UTF16ToUTF8($s);
$names[$record->nameID] = $record;
}
$data["records"] = $names;
$this->data = $data;
}
开发者ID:rmuyinda,项目名称:dms-1,代码行数:30,代码来源:font_table_name.cls.php
示例5: buildDataToInsert
private function buildDataToInsert($year, $subgroupId, $fontId, $typeId, $varietyId, $originId, $destinyId)
{
$font = new Font();
$font->setId($fontId);
$type = new CoffeType();
$type->setId($typeId);
$variety = new Variety();
$variety->setId($varietyId);
$origin = new Country();
$origin->setId($originId);
$destiny = new Country();
$destiny->setId($destinyId);
$subgroup = new Subgroup();
$subgroup->setId($subgroupId);
return new Data($year, $subgroup, $font, $type, $variety, $origin, $destiny);
}
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:16,代码来源:DatacenterService.php
示例6: CreateButtonAppearance
function CreateButtonAppearance($doc, $button_down)
{
// Create a button appearance stream ------------------------------------
$build = new ElementBuilder();
$writer = new ElementWriter();
$writer->Begin($doc->GetSDFDoc());
// Draw background
$element = $build->CreateRect(0, 0, 101, 37);
$element->SetPathFill(true);
$element->SetPathStroke(false);
$element->GetGState()->SetFillColorSpace(ColorSpace::CreateDeviceGray());
$element->GetGState()->SetFillColor(new ColorPt(0.75, 0.0, 0.0));
$writer->WriteElement($element);
// Draw 'Submit' text
$writer->WriteElement($build->CreateTextBegin());
$text = "Submit";
$element = $build->CreateTextRun($text, Font::Create($doc->GetSDFDoc(), Font::e_helvetica_bold), 12.0);
$element->GetGState()->SetFillColor(new ColorPt(0.0, 0.0, 0.0));
if ($button_down) {
$element->SetTextMatrix(1.0, 0.0, 0.0, 1.0, 33.0, 10.0);
} else {
$element->SetTextMatrix(1.0, 0.0, 0.0, 1.0, 30.0, 13.0);
}
$writer->WriteElement($element);
$writer->WriteElement($build->CreateTextEnd());
$stm = $writer->End();
// Set the bounding box
$stm->PutRect("BBox", 0, 0, 101, 37);
$stm->PutName("Subtype", "Form");
return $stm;
}
开发者ID:anrao91,项目名称:PDFNetWrappers,代码行数:31,代码来源:InteractiveFormsTest.php
示例7: _encode
protected function _encode(){
if (empty($this->data)) {
Font::d(" >> Table is empty");
return 0;
}
return $this->getFont()->pack($this->def, $this->data);
}
开发者ID:hendrosteven,项目名称:f3-template,代码行数:8,代码来源:Font_Table.php
示例8: __construct
function __construct()
{
parent::__construct();
$this->startTime = gettimeofday(true);
$message = " --- POWERED BY LIBCACA --- OLDSCHOOL TEXT EFFECTS ARE 100% PURE WIN";
$this->scroll = new Canvas(strlen($message), 1);
$this->scroll->setColorAnsi(AnsiColor::WHITE, AnsiColor::TRANSPARENT);
$this->scroll->putStr(0, 0, $message);
$fontList = Font::getList();
$f = new Font($fontList[1]);
$w = $f->getWidth() * strlen($message);
$h = $f->getHeight();
$this->image = imagecreatetruecolor($w, $h);
imagealphablending($this->image, false);
imagesavealpha($this->image, true);
$this->d = new Dither($this->image);
$f->Render($this->scroll, $this->image);
}
开发者ID:dns,项目名称:libcaca,代码行数:18,代码来源:test.php
示例9: showTestMode
/**
* Place watermark on the page if it is not licensed version
*
* @param pdfWriter {@link PdfWriter}
* @throws DocumentException
*/
private static function showTestMode($pdfDocument, $pdfWriter)
{
if (self::isLicensed()) {
return;
}
$font = new Font();
$font->setFontSize(25);
$font->setFontColor("#B5B5B5");
$font->setFont($pdfWriter);
$text = "WebORB PDF Gen Evaluation Copy";
$width = $pdfWriter->GetStringWidth($text);
$center["x"] = $pdfDocument->width / 2;
if ($width / 2 > $center["x"]) {
$width = $center["x"] * 2;
}
$center["y"] = $pdfDocument->height / 2;
$pdfWriter->Rotate(45, $center["x"], $center["y"]);
$pdfWriter->SetXY($center["x"] - $width / 2, $center["y"]);
$pdfWriter->Cell($width, 36, $text, 0, 0, "C");
$pdfWriter->Rotate(0, $center["x"], $center["y"]);
}
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:27,代码来源:PDFUtil.php
示例10: Font
function &create($typeface, $encoding, $font_resolver, &$error_message)
{
$font = new Font();
$font->underline_position = 0;
$font->underline_thickness = 0;
$font->ascender;
$font->descender;
$font->char_widths = array();
$font->bbox = array();
global $g_last_assigned_font_id;
$g_last_assigned_font_id++;
$font->name = "font" . $g_last_assigned_font_id;
// Get and load the metrics file
$afm = $font_resolver->get_afm_mapping($typeface);
if (!$font->_parse_afm($afm, $typeface, $encoding)) {
$error_message = $font->error_message();
$dummy = null;
return $dummy;
}
return $font;
}
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:21,代码来源:font.class.php
示例11:
function &get_type1($name, $encoding)
{
if (!isset($this->fonts[$name][$encoding])) {
global $g_font_resolver;
$font =& Font::create($name, $encoding, $g_font_resolver, $this->error_message);
if (is_null($font)) {
$dummy = null;
return $dummy;
}
$this->fonts[$name][$encoding] = $font;
}
return $this->fonts[$name][$encoding];
}
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:13,代码来源:font_factory.class.php
示例12: Load
public function Load()
{
parent::$PAGE_TITLE = __(HOME_PAGE_TITLE);
// Welcome message
$small_img = new Picture("img/logo_16x16.png", 16, 16, 0, Picture::ALIGN_ABSMIDDLE);
$title_header = new Object($small_img, __(WELCOME));
$welcome_box = new Box($title_header, true, Box::STYLE_SECOND, Box::STYLE_SECOND, "", "welcome_box", 600);
$welcome_obj = new Object(__(WELCOME_MSG));
list($strAdminLogin, $strAdminPasswd, $strAdminRights) = getWspUserRightsInfo("admin");
$quickstart_obj = new Object(new Picture("img/quickstart_128.png", 64, 64), "<br/>", __(QUICKSTART));
$quickstart_link = new Link("http://www.website-php.com/" . $this->getLanguage() . "/quick-start.html", Link::TARGET_BLANK, $quickstart_obj);
$quickstart_box = new RoundBox(3, "quickstart_box", 120, 120);
$quickstart_box->setValign(RoundBox::VALIGN_CENTER);
$quickstart_box->setContent($quickstart_link);
$tutorial_obj = new Object(new Picture("img/tutorials_128.png", 64, 64), "<br/>", __(TUTORIALS));
$tutorial_link = new Link("http://www.website-php.com/" . $this->getLanguage() . "/tutorials.html", Link::TARGET_BLANK, $tutorial_obj);
$tutorial_box = new RoundBox(3, "tutorial_box", 120, 120);
$tutorial_box->setValign(RoundBox::VALIGN_CENTER);
$tutorial_box->setContent($tutorial_link);
$connect_obj = new Object(new Picture("img/wsp-admin/admin_128.png", 64, 64), "<br/>", __(CONNECT));
$connect_link = new Link("wsp-admin/connect.html", Link::TARGET_BLANK, $connect_obj);
$connect_box = new RoundBox(3, "connect_box", 120, 120);
$connect_box->setValign(RoundBox::VALIGN_CENTER);
$connect_box->setContent($connect_link);
$icon_table = new Table();
$icon_table->setDefaultAlign(RowTable::ALIGN_CENTER)->setDefaultValign(RowTable::VALIGN_TOP);
$icon_row = $icon_table->addRowColumns($quickstart_box, " ", $tutorial_box, " ", $connect_box);
$icon_row->setColumnWidth(5, 120);
if ($strAdminLogin == "admin" && $strAdminPasswd == sha1("admin")) {
$finalize = new Font(__(FINALIZE_INSTALL));
$finalize->setFontColor("red");
$finalize->setFontWeight(Font::FONT_WEIGHT_BOLD);
$welcome_obj->add("<br/>", $finalize, "<br/>", __(CONNECT_DEFAULT_PASSWD), "<br/>");
}
$welcome_obj->add("<br/>", $icon_table);
$welcome_box->setContent($welcome_obj);
// Footer
$this->render = new Template($welcome_box);
}
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:39,代码来源:home.php
示例13: __construct
/**
* @param Font $font
* @param string $text
* @param int $color
* @param int $spacing
* @throws FontException
*/
public function __construct(Font $font, $text, $color, $spacing = 1)
{
$cw = $font->getWidth();
$ch = $font->getHeight();
// no support for UTF-8 or newlines!
$num_chars = strlen($text);
$full_width = $cw * $num_chars + ($num_chars - 1) * $spacing;
$full_height = $ch;
$pixels = array_fill(0, $full_width * $full_height, 0);
for ($i = 0; $i < $num_chars; ++$i) {
$char = ord($text[$i]);
$cox = ($cw + $spacing) * $i;
$char_pixels = $font->getPixelsForCharacter($char);
for ($y = 0; $y < $ch; ++$y) {
for ($x = 0; $x < $cw; ++$x) {
if ($char_pixels[$y * $cw + $x]) {
$pixels[$full_width * $y + $cox + $x] = $color;
}
}
}
}
parent::__construct($full_width, $full_height, $pixels);
}
开发者ID:hackheim,项目名称:pixelpong,代码行数:30,代码来源:TextBitmap.php
示例14: encode
function encode($entry_offset)
{
Font::d("\n==== {$this->tag} ====");
$data = $this->font_table;
$font = $this->font;
$table_offset = $font->pos();
$table_length = $data->encode();
$font->seek($table_offset);
$table_data = $font->read($table_length);
$font->seek($entry_offset);
$font->write($this->tag, 4);
$font->writeUInt32(self::computeChecksum($table_data));
$font->writeUInt32($table_offset);
$font->writeUInt32($table_length);
Font::d("Bytes written = {$table_length}");
$font->seek($table_offset + $table_length);
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:17,代码来源:font_table_directory_entry.cls.php
示例15: AddCoverPage
function AddCoverPage($doc)
{
// Here we dynamically generate cover page (please see ElementBuilder
// sample for more extensive coverage of PDF creation API).
$page = $doc->PageCreate(new Rect(0.0, 0.0, 200.0, 200.0));
$builder = new ElementBuilder();
$writer = new ElementWriter();
$writer->Begin($page);
$font = Font::Create($doc->GetSDFDoc(), Font::e_helvetica);
$writer->WriteElement($builder->CreateTextBegin($font, 12.0));
$element = $builder->CreateTextRun("My PDF Collection");
$element->SetTextMatrix(1.0, 0.0, 0.0, 1.0, 50.0, 96.0);
$element->GetGState()->SetFillColorSpace(ColorSpace::CreateDeviceRGB());
$element->GetGState()->SetFillColor(new ColorPt(1.0, 0.0, 0.0));
$writer->WriteElement($element);
$writer->WriteElement($builder->CreateTextEnd());
$writer->End();
$doc->PagePushBack($page);
// Alternatively we could import a PDF page from a template PDF document
// (for an example please see PDFPage sample project).
// ...
}
开发者ID:anrao91,项目名称:PDFNetWrappers,代码行数:22,代码来源:PDFPackageTest.php
示例16: install_font_family
/**
* Installs a new font family
*
* This function maps a font-family name to a font. It tries to locate the
* bold, italic, and bold italic versions of the font as well. Once the
* files are located, ttf versions of the font are copied to the fonts
* directory. Changes to the font lookup table are saved to the cache.
*
* @param string $fontname the font-family name
* @param string $normal the filename of the normal face font subtype
* @param string $bold the filename of the bold face font subtype
* @param string $italic the filename of the italic face font subtype
* @param string $bold_italic the filename of the bold italic face font subtype
*/
function install_font_family($fontname, $normal, $bold = null, $italic = null, $bold_italic = null)
{
Font_Metrics::init();
// Check if the base filename is readable
if (!is_readable($normal)) {
throw new DOMPDF_Exception("Unable to read '{$normal}'.");
}
$dir = dirname($normal);
$basename = basename($normal);
$last_dot = strrpos($basename, '.');
if ($last_dot !== false) {
$file = substr($basename, 0, $last_dot);
$ext = strtolower(substr($basename, $last_dot));
} else {
$file = $basename;
$ext = '';
}
if (!in_array($ext, array(".ttf", ".otf"))) {
throw new DOMPDF_Exception("Unable to process fonts of type '{$ext}'.");
}
// Try $file_Bold.$ext etc.
$path = "{$dir}/{$file}";
$patterns = array("bold" => array("_Bold", "b", "B", "bd", "BD"), "italic" => array("_Italic", "i", "I"), "bold_italic" => array("_Bold_Italic", "bi", "BI", "ib", "IB"));
foreach ($patterns as $type => $_patterns) {
if (!isset(${$type}) || !is_readable(${$type})) {
foreach ($_patterns as $_pattern) {
if (is_readable("{$path}{$_pattern}{$ext}")) {
${$type} = "{$path}{$_pattern}{$ext}";
break;
}
}
if (is_null(${$type})) {
echo "Unable to find {$type} face file.\n";
}
}
}
$fonts = compact("normal", "bold", "italic", "bold_italic");
$entry = array();
// Copy the files to the font directory.
foreach ($fonts as $var => $src) {
if (is_null($src)) {
$entry[$var] = DOMPDF_FONT_DIR . mb_substr(basename($normal), 0, -4);
continue;
}
// Verify that the fonts exist and are readable
if (!is_readable($src)) {
throw new DOMPDF_Exception("Requested font '{$src}' is not readable");
}
$dest = DOMPDF_FONT_DIR . basename($src);
if (!is_writeable(dirname($dest))) {
throw new DOMPDF_Exception("Unable to write to destination '{$dest}'.");
}
echo "Copying {$src} to {$dest}...\n";
if (!copy($src, $dest)) {
throw new DOMPDF_Exception("Unable to copy '{$src}' to '{$dest}'");
}
$entry_name = mb_substr($dest, 0, -4);
echo "Generating Adobe Font Metrics for {$entry_name}...\n";
$font_obj = Font::load($dest);
$font_obj->saveAdobeFontMetrics("{$entry_name}.ufm");
$entry[$var] = $entry_name;
}
// Store the fonts in the lookup table
Font_Metrics::set_font_family($fontname, $entry);
// Save the changes
Font_Metrics::save_font_families();
}
开发者ID:fredcido,项目名称:simuweb,代码行数:81,代码来源:load_font.php
示例17: _getFont
/**
* Gets the font of the element.
*
* If not font has been set, the parent font is propagated through it's
* children.
*
* @param array $options Font options
*
* @return array An associated array used for canvas
* @access private
*/
function _getFont($options = false)
{
if ($options === false && $this->_defaultFontOptions !== false) {
return $this->_defaultFontOptions;
}
if ($options === false) {
$saveDefault = true;
} else {
$saveDefault = false;
}
if ($options === false) {
$options = $this->_fontOptions;
} else {
$options = array_merge($this->_fontOptions, $options);
}
if ($this->_font == null) {
$result = $this->_parent->_getFont($options);
} else {
$result = $this->_font->_getFont($options);
}
if (isset($result['size']) && isset($result['size_rel'])) {
$result['size'] += $result['size_rel'];
unset($result['size_rel']);
}
if ($saveDefault) {
$this->_defaultFontOptions = $result;
}
return $result;
}
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:40,代码来源:Element.php
示例18: register_font
static function register_font($style, $remote_file)
{
$fontname = mb_strtolower($style["family"]);
$families = Font_Metrics::get_font_families();
$entry = array();
if (isset($families[$fontname])) {
$entry = $families[$fontname];
}
$local_file = DOMPDF_FONT_DIR . md5($remote_file);
$cache_entry = $local_file;
$local_file .= ".ttf";
$style_string = Font_Metrics::get_type("{$style['weight']} {$style['style']}");
if (!isset($entry[$style_string])) {
$entry[$style_string] = $cache_entry;
Font_Metrics::set_font_family($fontname, $entry);
// Download the remote file
if (!is_file($local_file)) {
file_put_contents($local_file, file_get_contents($remote_file));
}
$font = Font::load($local_file);
if (!$font) {
return false;
}
$font->parse();
$font->saveAdobeFontMetrics("{$cache_entry}.ufm");
// Save the changes
Font_Metrics::save_font_families();
}
return true;
}
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:30,代码来源:font_metrics.cls.php
示例19: basename
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
$fontfile = null;
if (isset($_GET["fontfile"])) {
$fontfile = basename($_GET["fontfile"]);
$fontfile = "../fonts/{$fontfile}";
}
if (!file_exists($fontfile)) {
return;
}
$name = isset($_GET["name"]) ? $_GET["name"] : null;
if (isset($_POST["subset"])) {
$subset = $_POST["subset"];
ob_start();
require_once "../classes/Font.php";
$font = Font::load($fontfile);
$font->parse();
$font->setSubset($subset);
$font->reduce();
$new_filename = basename($fontfile);
$new_filename = substr($new_filename, 0, -4) . "-subset." . substr($new_filename, -3);
header("Content-Type: font/truetype");
header("Content-Disposition: attachment; filename=\"{$new_filename}\"");
$tmp = tempnam(sys_get_temp_dir(), "fnt");
$font->open($tmp, Font_Binary_Stream::modeWrite);
$font->encode(array("OS/2"));
$font->close();
ob_end_clean();
readfile($tmp);
unlink($tmp);
return;
开发者ID:alvarobfdev,项目名称:applog,代码行数:31,代码来源:make_subset.php
示例20: getUTF16
public function getUTF16()
{
return Font::UTF8ToUTF16($this->string);
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:4,代码来源:font_table_name_record.cls.php
注:本文中的Font类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论