当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Pdf_Style::getFontSize方法代码示例

本文整理汇总了PHP中Zend_Pdf_Style::getFontSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Style::getFontSize方法的具体用法?PHP Zend_Pdf_Style::getFontSize怎么用?PHP Zend_Pdf_Style::getFontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Pdf_Style的用法示例。


在下文中一共展示了Zend_Pdf_Style::getFontSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getWrappedText

 protected function _getWrappedText($string, Zend_Pdf_Style $style, $max_width)
 {
     $wrappedText = '';
     $lines = explode("\n", $string);
     foreach ($lines as $line) {
         $words = explode(' ', $line);
         $word_count = count($words);
         $i = 0;
         $wrappedLine = '';
         while ($i < $word_count) {
             /* if adding a new word isn't wider than $max_width,
                we add the word */
             if ($this->widthForStringUsingFontSize($wrappedLine . ' ' . $words[$i], $style->getFont(), $style->getFontSize()) < $max_width) {
                 if (!empty($wrappedLine)) {
                     $wrappedLine .= ' ';
                 }
                 $wrappedLine .= $words[$i];
             } else {
                 $wrappedText .= $wrappedLine . "\n";
                 $wrappedLine = $words[$i];
             }
             $i++;
         }
         $wrappedText .= $wrappedLine . "\n";
     }
     return $wrappedText;
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:27,代码来源:Couponcode.php

示例2: setStyle

 /**
  * Set the style to use for future drawing operations on this page
  *
  * @param Zend_Pdf_Style $style
  * @return Zend_Pdf_Page
  */
 public function setStyle(Zend_Pdf_Style $style)
 {
     $this->_style = $style;
     $this->_addProcSet('Text');
     $this->_addProcSet('PDF');
     if ($style->getFont() !== null) {
         $this->setFont($style->getFont(), $style->getFontSize());
     }
     $this->_contents .= $style->instructions($this->_pageDictionary->Resources);
     return $this;
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:17,代码来源:Page.php

示例3: drawTable

 /**
  * Draw table or part of table by coordinates with or without header
  *
  * @param array[][] $table Table values
  * @param int $x x coordinate
  * @param int $y y coordinate
  * @param int $width Table width
  * @param int $max_y Minimal y coordinate
  * @param array[] $header Table header
  * @param int $start_row start row of table
  *
  * @return int End row
  *
  * @api
  */
 function drawTable($table, $x, $y, $width, $max_y = 0, $header = NULL, $start_row = 0, $params = false, $note = '')
 {
     if (!$table) {
         return NULL;
     }
     if ($start_row > count($table) - 1) {
         if ($this->currentPosition > $y - $this->MARGIN['bottom']) {
             $this->currentPosition = $y - $this->MARGIN['bottom'];
         }
         return NULL;
     }
     $max_widths = $this->getTableColumnsMaxWidths($table, $params);
     $avg_widths = $this->getTableColumnsAverageWidths($table, $params);
     //	parent::drawText(implode(',',$max_widths), $this -> MARGIN['left'], $this -> MARGIN['bottom'], 'UTF-8');
     //вычисляем ширину столбцов, в зависимости от того, какую таблицу рисуем выбираем нужную формулу
     if ($params) {
         $awidth = array_sum($max_widths) - 0;
     } else {
         $awidth = array_sum($avg_widths) - $avg_widths[0] - 5;
         $widths = array($max_widths[0]);
     }
     // Подгоняем ширину под заданную, через процентные соотношения
     foreach ($avg_widths as $i => $a_w) {
         if ($params) {
             $widths[] = $a_w / $awidth * $width;
         } elseif ($i != 0) {
             $widths[] = $a_w / $awidth * ($width - $widths[0] - 10);
         }
     }
     // запомним наш $x  и текущий $y
     $coords = array($x, $y);
     // write header ( if exists )
     if ($header) {
         //создаем сностки для таблици с параметрами. В зависимости от количества столбцов и длинны названия параметра, заменяем его и записываем в сноски
         $snoski = '';
         $s_number = 1;
         $widthSnoski = $width;
         $this->pageFormat == 'A4' ? $countChar = 30 : ($countChar = 10);
         foreach ($header as $i => $column) {
             if (count($header) > 7 && strlen($column) >= $countChar && $i != 0 || $column == 'Типоразмер') {
                 if ($widthSnoski < $this->widthForStringUsingFontsize($s_number . '* - ' . $column . '; ', Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski) + $this->widthForStringUsingFontsize($snoski, Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski)) {
                     $snoski .= chr('0x0D') . chr('0x0A');
                     $widthSnoski *= 2;
                 }
                 $snoski .= $s_number . '* - ' . $column . '; ';
                 $header[$i] = $s_number . '*';
                 $s_number++;
             } elseif ($this->pageFormat == 'A5') {
                 $header[$i] = str_replace('(', chr('0x0D') . chr('0x0A') . '(', $column);
             }
         }
         $snoski .= ' ' . $note;
         $this->saveGS();
         $style = new Zend_Pdf_Style();
         $style->setFillColor(new Zend_Pdf_Color_Html("white"));
         $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatHeader);
         // Bold
         $this->setStyle($style);
         // calculate height of header
         $height = 0;
         foreach ($header as $i => $column) {
             $style->setLineWidth($widths[$i]);
             $height = max($height, $this->getTextBlockHeight(trim($column), $style, 0, true));
         }
         // if we can't write 2 line - exit
         if ($y - $height - $max_y < 16) {
             $this->restoreGS();
             return 0;
         }
         // else - draw header background
         $this->drawHorizontalLine($coords[0] + 5, $coords[0] + $width, $this->pageFormat == 'A4' ? $y - $height / 2 + 5.5 : $y - $height / 2 + 3.5, $height, new Zend_Pdf_Color_Html("#0095da"));
         // here - write header
         //
         foreach ($header as $i => $col) {
             $style->setLineWidth($widths[$i]);
             $width_text = $this->widthForStringUsingFontsize($col, $style->getFont(), $style->getFontSize());
             if ($widths[$i] > $width_text && $i != 0) {
                 $iLeft = $x + ($widths[$i] - $width_text) / 2;
             } else {
                 $iLeft = $x + 8;
             }
             $y = min($y, $this->drawTextBlock(str_replace(array(''), array(''), trim($col)), $iLeft + 1 * ($i == 0), $coords[1] - 3, $style, 0, true));
             $x += $widths[$i];
         }
         $this->restoreGS();
//.........这里部分代码省略.........
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:101,代码来源:PdfPage.php


注:本文中的Zend_Pdf_Style::getFontSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。