本文整理汇总了PHP中Font类的典型用法代码示例。如果您正苦于以下问题:PHP Font类的具体用法?PHP Font怎么用?PHP Font使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Font类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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;
}
示例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);
}
示例4: __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);
}
示例5: _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;
}
示例6: 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);
}
示例7: 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;
}
示例8: _encode
protected function _encode(){
if (empty($this->data)) {
Font::d(" >> Table is empty");
return 0;
}
return $this->getFont()->pack($this->def, $this->data);
}
示例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"]);
}
示例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;
}
示例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];
}
示例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);
}
示例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);
}
示例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).
// ...
}