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


PHP Font_Metrics::get_font_height方法代码示例

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


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

示例1: get_margin_height

 function get_margin_height()
 {
     $style = $this->get_style();
     $font = $style->font_family;
     $size = $style->font_size;
     return $style->line_height / $size * Font_Metrics::get_font_height($font, $size);
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:7,代码来源:text_frame_decorator.cls.php

示例2: pdf_create

 function pdf_create($html, $filename, $stream = TRUE)
 {
     $dompdf = new DOMPDF();
     $dompdf->set_paper("A4");
     $dompdf->load_html($html);
     $dompdf->render();
     $canvas = $dompdf->get_canvas();
     // get height and width of page
     $w = $canvas->get_width();
     $h = $canvas->get_height();
     // get font
     $font = Font_Metrics::get_font("helvetica", "normal");
     $txtHeight = Font_Metrics::get_font_height($font, 7);
     //draw line for signature manager
     $mnline = $h - 10 * $txtHeight - 24;
     $colormn = array(0, 0, 0);
     $canvas->line(20, $mnline, $w - 470, $mnline, $colormn, 1);
     //text for signature Requestor/HOD
     $textmn = "Requestor/HOD";
     $widthmn = Font_Metrics::get_text_width($textmn, $font, 12);
     $canvas->text($w - $widthmn - 480, $mnline, $textmn, $font, 12);
     // draw a line along the bottom
     $y = $h - 2 * $txtHeight - 24;
     $color = array(0, 0, 0);
     $canvas->line(16, $y, $w - 16, $y, $color, 1);
     //draw line for GM/Manager
     //$canvas->line(270, $mnline, $w - 240, $mnline, $colormn, 1);
     $canvas->line(330, $mnline, $w - 170, $mnline, $colormn, 1);
     $texthr = "GM/Manager";
     $widthhr = Font_Metrics::get_text_width($texthr, $font, 12);
     $canvas->text($w - $widthmn - 160, $mnline, $texthr, $font, 12);
     //draw line for HR
     //$canvas->line(270, $mnline, $w - 240, $mnline, $colormn, 1);
     $canvas->line(180, $mnline, $w - 310, $mnline, $colormn, 1);
     $texthr = "HR";
     $widthhr = Font_Metrics::get_text_width($texthr, $font, 12);
     $canvas->text($w - $widthmn - 325, $mnline, $texthr, $font, 12);
     //draw line for IT Officer
     $canvas->line(470, $mnline, $w - 20, $mnline, $colormn, 1);
     $textIT = "IT Officer";
     $canvas->text($w - $widthmn - 30, $mnline, $textIT, $font, 12);
     // set page number on the left side
     //$canvas->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);
     $canvas->page_text($w - 324, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);
     // set additional text
     $text = "ESRNL PORTAL";
     $width = Font_Metrics::get_text_width($text, $font, 8);
     $canvas->text($w - $width - 16, $y, $text, $font, 8);
     if ($stream) {
         $dompdf->stream($filename . ".pdf");
     } else {
         $CI =& get_instance();
         $CI->load->helper('file');
         write_file($filename, $dompdf->output());
     }
 }
开发者ID:kielnevec,项目名称:PORTAL_Ingress_by_Fingertec,代码行数:56,代码来源:pdf.php

示例3: get_margin_height

 function get_margin_height()
 {
     // This function is called in add_frame_to_line() and is used to
     // determine the line height, so we actually want to return the
     // 'line-height' property, not the actual margin box
     $style = $this->get_style();
     $font = $style->font_family;
     $size = $style->font_size;
     /*
      * pre_r('-----'); pre_r($style->line_height); pre_r($style->font_size); pre_r(Font_Metrics::get_font_height($font, $size)); pre_r(($style->line_height / $size) * Font_Metrics::get_font_height($font, $size));
      */
     return $style->line_height / $size * Font_Metrics::get_font_height($font, $size);
 }
开发者ID:julkar9,项目名称:gss,代码行数:13,代码来源:text_frame_decorator.cls.php

示例4: __construct

 /**
  * Class constructor
  *
  * @param Frame  $frame  the frame to decorate
  * @param DOMPDF $dompdf the document's dompdf object (required to resolve relative & remote urls)
  */
 function __construct(Frame $frame, DOMPDF $dompdf)
 {
     parent::__construct($frame, $dompdf);
     $url = $frame->get_node()->getAttribute("src");
     $debug_png = $dompdf->get_option("debug_png");
     if ($debug_png) {
         print '[__construct ' . $url . ']';
     }
     list($this->_image_url, , $this->_image_msg) = Image_Cache::resolve_url($url, $dompdf->get_protocol(), $dompdf->get_host(), $dompdf->get_base_path(), $dompdf);
     if (Image_Cache::is_broken($this->_image_url) && ($alt = $frame->get_node()->getAttribute("alt"))) {
         $style = $frame->get_style();
         $style->width = 4 / 3 * Font_Metrics::get_text_width($alt, $style->font_family, $style->font_size, $style->word_spacing);
         $style->height = Font_Metrics::get_font_height($style->font_family, $style->font_size);
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:21,代码来源:image_frame_decorator.cls.php

示例5: __construct

 /**
  * Class constructor
  *
  * @param Frame $frame the frame to decorate
  * @param DOMPDF $dompdf the document's dompdf object (required to resolve relative & remote urls)
  */
 function __construct(Frame $frame, DOMPDF $dompdf)
 {
     global $_dompdf_warnings;
     parent::__construct($frame, $dompdf);
     $url = $frame->get_node()->getAttribute("src");
     //debugpng
     if (DEBUGPNG) {
         print '[__construct ' . $url . ']';
     }
     list($this->_image_url, $this->_image_ext) = Image_Cache::resolve_url($url, $dompdf->get_protocol(), $dompdf->get_host(), $dompdf->get_base_path());
     if (strrpos($this->_image_url, DOMPDF_LIB_DIR . "/res/broken_image.png", 0) !== false && ($alt = $frame->get_node()->getAttribute("alt"))) {
         $style = $frame->get_style();
         $style->width = 4 / 3 * Font_Metrics::get_text_width($alt, $style->font_family, $style->font_size, $style->word_spacing);
         $style->height = Font_Metrics::get_font_height($style->font_family, $style->font_size);
     }
 }
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:22,代码来源:image_frame_decorator.cls.php

示例6: __construct

    /**
     * Class constructor
     *
     * @param Frame $frame the frame to decorate
     * @param DOMPDF $dompdf the document's dompdf object (required to resolve relative & remote urls)
     */
    function __construct(Frame $frame, DOMPDF $dompdf)
    {
        global $_dompdf_warnings;

        parent::__construct($frame, $dompdf);
        $url = $frame->get_node()->getAttribute("src");

        //debugpng
        if (DEBUGPNG) print '[__construct ' . $url . ']';

        list($this->_image_url, $type, $this->_image_msg) = Image_Cache::resolve_url($url,
            $dompdf->get_protocol(),
            $dompdf->get_host(),
            $dompdf->get_base_path());

        if (Image_Cache::is_broken($this->_image_url) &&
            $alt = $frame->get_node()->getAttribute("alt")
        ) {
            $style = $frame->get_style();
            $style->width = (4 / 3) * Font_Metrics::get_text_width($alt, $style->font_family, $style->font_size, $style->word_spacing);
            $style->height = Font_Metrics::get_font_height($style->font_family, $style->font_size);
        }
    }
开发者ID:rmuyinda,项目名称:dms-1,代码行数:29,代码来源:image_frame_decorator.cls.php

示例7: _layout_line

 protected function _layout_line()
 {
     $style = $this->_frame->get_style();
     $text = $this->_frame->get_text();
     $size = $style->font_size;
     $font = $style->font_family;
     $word_spacing = $style->length_in_pt($style->word_spacing);
     $char_spacing = $style->length_in_pt($style->letter_spacing);
     // Determine the text height
     $style->height = Font_Metrics::get_font_height($font, $size);
     $split = false;
     $add_line = false;
     // Handle text transform:
     // http://www.w3.org/TR/CSS21/text.html#propdef-text-transform
     switch (strtolower($style->text_transform)) {
         default:
             break;
         case "capitalize":
             $text = mb_convert_case($text, MB_CASE_TITLE);
             break;
         case "uppercase":
             $text = mb_convert_case($text, MB_CASE_UPPER);
             break;
         case "lowercase":
             $text = mb_convert_case($text, MB_CASE_LOWER);
             break;
     }
     // Handle white-space property:
     // http://www.w3.org/TR/CSS21/text.html#propdef-white-space
     switch ($style->white_space) {
         default:
         case "normal":
             $this->_frame->set_text($text = $this->_collapse_white_space($text));
             if ($text == "") {
                 break;
             }
             $split = $this->_line_break($text);
             break;
         case "pre":
             $split = $this->_newline_break($text);
             $add_line = $split !== false;
             break;
         case "nowrap":
             $this->_frame->set_text($text = $this->_collapse_white_space($text));
             break;
         case "pre-wrap":
             $split = $this->_newline_break($text);
             if (($tmp = $this->_line_break($text)) !== false) {
                 $add_line = $split < $tmp;
                 $split = min($tmp, $split);
             } else {
                 $add_line = true;
             }
             break;
         case "pre-line":
             // Collapse white-space except for \n
             $this->_frame->set_text($text = preg_replace("/[ \t]+/u", " ", $text));
             if ($text == "") {
                 break;
             }
             $split = $this->_newline_break($text);
             if (($tmp = $this->_line_break($text)) !== false) {
                 $add_line = $split < $tmp;
                 $split = min($tmp, $split);
             } else {
                 $add_line = true;
             }
             break;
     }
     // Handle degenerate case
     if ($text === "") {
         return;
     }
     if ($split !== false) {
         // Handle edge cases
         if ($split == 0 && $text === " ") {
             $this->_frame->set_text("");
             return;
         }
         if ($split == 0) {
             // Trim newlines from the beginning of the line
             //$this->_frame->set_text(ltrim($text, "\n\r"));
             $this->_block_parent->add_line();
             $this->_frame->position();
             // Layout the new line
             $this->_layout_line();
         } else {
             if ($split < mb_strlen($this->_frame->get_text())) {
                 // split the line if required
                 $this->_frame->split_text($split);
                 $t = $this->_frame->get_text();
                 // Remove any trailing newlines
                 if ($split > 1 && $t[$split - 1] === "\n") {
                     $this->_frame->set_text(mb_substr($t, 0, -1));
                 }
                 // Do we need to trim spaces on wrapped lines? This might be desired, however, we
                 // can't trim the lines here or the layout will be affected if trimming the line
                 // leaves enough space to fit the next word in the text stream (because pdf layout
                 // is performed elsewhere).
                 /*if (!$this->_frame->get_prev_sibling() && !$this->_frame->get_next_sibling()) {
//.........这里部分代码省略.........
开发者ID:rapsody,项目名称:HeartwebApp,代码行数:101,代码来源:text_frame_reflower.cls.php

示例8: _layout_line

 protected function _layout_line()
 {
     $style = $this->_frame->get_style();
     $text = $this->_frame->get_text();
     $size = $style->font_size;
     $font = $style->font_family;
     $word_spacing = $style->length_in_pt($style->word_spacing);
     // Determine the text height
     $style->height = Font_Metrics::get_font_height($font, $size);
     $split = false;
     $add_line = false;
     // Handle text transform:
     // http://www.w3.org/TR/CSS21/text.html#propdef-text-transform
     switch ($style->text_transform) {
         default:
             break;
         case "capitalize":
             $text = mb_convert_case($text, MB_CASE_TITLE, 'UTF-8');
             break;
         case "uppercase":
             $text = mb_convert_case($text, MB_CASE_UPPER, 'UTF-8');
             break;
         case "lowercase":
             $text = mb_convert_case($text, MB_CASE_LOWER, 'UTF-8');
             break;
     }
     // Handle white-space property:
     // http://www.w3.org/TR/CSS21/text.html#propdef-white-space
     switch ($style->white_space) {
         default:
         case "normal":
             $this->_frame->set_text($text = $this->_collapse_white_space($text));
             if ($text == "") {
                 break;
             }
             $split = $this->_line_break($text);
             break;
         case "pre":
             $split = $this->_newline_break($text);
             $add_line = $split !== false;
             break;
         case "nowrap":
             $this->_frame->set_text($text = $this->_collapse_white_space($text));
             break;
         case "pre-wrap":
             $split = $this->_newline_break($text);
             if (($tmp = $this->_line_break($text)) !== false) {
                 $add_line = $split < $tmp;
                 $split = min($tmp, $split);
             } else {
                 $add_line = true;
             }
             break;
         case "pre-line":
             // Collapse white-space except for \n
             $this->_frame->set_text($text = preg_replace("/[ \t]+/u", " ", $text));
             if ($text == "") {
                 break;
             }
             $split = $this->_newline_break($text);
             if (($tmp = $this->_line_break($text)) !== false) {
                 $add_line = $split < $tmp;
                 $split = min($tmp, $split);
             } else {
                 $add_line = true;
             }
             break;
     }
     // Handle degenerate case
     if ($text === "") {
         return;
     }
     if ($split !== false) {
         // Handle edge cases
         if ($split == 0 && $text === " ") {
             $this->_frame->set_text("");
             return;
         }
         if ($split == 0) {
             // Trim newlines from the beginning of the line
             //$this->_frame->set_text(ltrim($text, "\n\r"));
             $this->_block_parent->add_line();
             $this->_frame->position();
             // Layout the new line
             $this->_layout_line();
         } else {
             if ($split < mb_strlen($this->_frame->get_text())) {
                 // split the line if required
                 $this->_frame->split_text($split);
                 // Remove any trailing newlines
                 $t = $this->_frame->get_text();
                 if ($split > 1 && $t[$split - 1] === "\n") {
                     $this->_frame->set_text(mb_substr($t, 0, -1));
                 }
             }
         }
         if ($add_line) {
             $this->_block_parent->add_line();
             $this->_frame->position();
         }
//.........这里部分代码省略.........
开发者ID:kuwox,项目名称:buenavista,代码行数:101,代码来源:text_frame_reflower.cls.php

示例9: text

 function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0)
 {
     $fh = $this->_load_font($font);
     $this->_pdf->setfont($fh, $size);
     $this->_set_fill_color($color);
     $y = $this->y($y) - Font_Metrics::get_font_height($font, $size);
     $adjust = (double) $adjust;
     $angle = -(double) $angle;
     //$this->_pdf->fit_textline(utf8_decode($text), $x, $y, "rotate=$angle wordspacing=$adjust");
     $this->_pdf->fit_textline($text, $x, $y, "rotate={$angle} wordspacing={$adjust}");
 }
开发者ID:artre,项目名称:study,代码行数:11,代码来源:pdflib_adapter.cls.php

示例10: text

  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $word_spacing = 0, $char_spacing = 0, $angle = 0) {
    $fh = $this->_load_font($font);

    $this->_pdf->setfont($fh, $size);
    $this->_set_fill_color($color);

    $y = $this->y($y) - Font_Metrics::get_font_height($font, $size);

    $word_spacing = (float)$word_spacing;
    $char_spacing = (float)$char_spacing;
    $angle        = -(float)$angle;

    $this->_pdf->fit_textline($text, $x, $y, "rotate=$angle wordspacing=$word_spacing charspacing=$char_spacing ");

  }
开发者ID:hendrosteven,项目名称:f3-template,代码行数:15,代码来源:pdflib_adapter.cls.php

示例11: _layout_line

 protected function _layout_line()
 {
     $frame = $this->_frame;
     $style = $frame->get_style();
     $text = $frame->get_text();
     $size = $style->font_size;
     $font = $style->font_family;
     $style->height = Font_Metrics::get_font_height($font, $size);
     $split = false;
     $add_line = false;
     switch (strtolower($style->text_transform)) {
         default:
             break;
         case "capitalize":
             $text = mb_convert_case($text, MB_CASE_TITLE);
             break;
         case "uppercase":
             $text = mb_convert_case($text, MB_CASE_UPPER);
             break;
         case "lowercase":
             $text = mb_convert_case($text, MB_CASE_LOWER);
             break;
     }
     switch ($style->white_space) {
         default:
         case "normal":
             $frame->set_text($text = $this->_collapse_white_space($text));
             if ($text == "") {
                 break;
             }
             $split = $this->_line_break($text);
             break;
         case "pre":
             $split = $this->_newline_break($text);
             $add_line = $split !== false;
             break;
         case "nowrap":
             $frame->set_text($text = $this->_collapse_white_space($text));
             break;
         case "pre-wrap":
             $split = $this->_newline_break($text);
             if (($tmp = $this->_line_break($text)) !== false) {
                 $add_line = $split < $tmp;
                 $split = min($tmp, $split);
             } else {
                 $add_line = true;
             }
             break;
         case "pre-line":
             $frame->set_text($text = preg_replace("/[ \t]+/u", " ", $text));
             if ($text == "") {
                 break;
             }
             $split = $this->_newline_break($text);
             if (($tmp = $this->_line_break($text)) !== false) {
                 $add_line = $split < $tmp;
                 $split = min($tmp, $split);
             } else {
                 $add_line = true;
             }
             break;
     }
     if ($text === "") {
         return;
     }
     if ($split !== false) {
         if ($split == 0 && $text === " ") {
             $frame->set_text("");
             return;
         }
         if ($split == 0) {
             $this->_block_parent->add_line();
             $frame->position();
             $this->_layout_line();
         } else {
             if ($split < mb_strlen($frame->get_text())) {
                 $frame->split_text($split);
                 $t = $frame->get_text();
                 if ($split > 1 && $t[$split - 1] === "\n" && !$frame->is_pre()) {
                     $frame->set_text(m_mb_substr($t, 0, -1));
                 }
             }
         }
         if ($add_line) {
             $this->_block_parent->add_line();
             $frame->position();
         }
     } else {
         $t = $frame->get_text();
         $parent = $frame->get_parent();
         $is_inline_frame = get_class($parent) === 'Inline_Frame_Decorator';
         if (!$is_inline_frame && !$frame->get_next_sibling() || $is_inline_frame && !$parent->get_next_sibling()) {
             $t = rtrim($t);
         }
         if (!$is_inline_frame && !$frame->get_prev_sibling()) {
             $t = ltrim($t);
         }
         $frame->set_text($t);
     }
     $width = $frame->recalculate_width();
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:101,代码来源:text_frame_reflower.cls.php

示例12: text

 function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0, $blend = "Normal", $opacity = 1.0)
 {
     list($r, $g, $b) = $color;
     $this->_pdf->setColor($r, $g, $b);
     $this->_set_line_transparency($blend, $opacity);
     $this->_set_fill_transparency($blend, $opacity);
     $font .= ".afm";
     $this->_pdf->selectFont($font);
     $this->_pdf->addText($x, $this->y($y) - Font_Metrics::get_font_height($font, $size), $size, utf8_decode($text), $angle, $adjust);
 }
开发者ID:SkMamtajuddin,项目名称:bamboo-invoice,代码行数:10,代码来源:cpdf_adapter.cls.php

示例13: text

 function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $word_spacing = 0, $char_spacing = 0, $angle = 0)
 {
     $fh = $this->_load_font($font);
     $this->_pdf->setfont($fh, $size);
     $this->_set_fill_color($color);
     $y = $this->y($y) - Font_Metrics::get_font_height($font, $size);
     $word_spacing = (double) $word_spacing;
     $char_spacing = (double) $char_spacing;
     $angle = -(double) $angle;
     //***$this->_pdf->fit_textline($text, $x, $y, "rotate=$angle wordspacing=$word_spacing charspacing=$char_spacing ");
     $this->_pdf->fit_textline($this->_pdf->utf8_to_utf16($text, ""), $x, $y, "rotate={$angle} wordspacing={$word_spacing} charspacing={$char_spacing} ");
     //***
 }
开发者ID:Razinsky,项目名称:echaude-com,代码行数:13,代码来源:pdflib_adapter.cls.php


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