コード例 #1
0
 /**
  * Optimization: _readCSSLength is usually called several times
  * while initializing box object. $base_font_size cound be calculated 
  * only once and stored in a static variable.
  */
 function _readCSSLengths($state, $property_list)
 {
     if (is_null($this->_cached_base_font_size)) {
         $font =& $this->getCSSProperty(CSS_FONT);
         if (!$font) {
             $font = CSSFont::default_value();
         }
         $this->_cached_base_font_size = $font->size->getPoints();
     }
     foreach ($property_list as $property) {
         $value =& $state->getProperty($property);
         if ($value === CSS_PROPERTY_INHERIT) {
             $value =& $state->getInheritedProperty($property);
         }
         if (is_object($value)) {
             $value =& $value->copy();
             $value->doInherit($state);
             $value->units2pt($this->_cached_base_font_size);
         }
         $this->setCSSProperty($property, $value);
     }
 }
コード例 #2
0
 function _get_font_name(&$viewport, $subword_index)
 {
     if (isset($this->_cache[CACHE_TYPEFACE][$subword_index])) {
         return $this->_cache[CACHE_TYPEFACE][$subword_index];
     }
     $font_resolver =& $viewport->get_font_resolver();
     $font = $this->getCSSProperty(CSS_FONT);
     if (!$font) {
         $font = CSSFont::default_value();
     }
     $typeface = $font_resolver->getTypefaceName($font->family, $font->weight, $font->style, $this->encodings[$subword_index]);
     $this->_cache[CACHE_TYPEFACE][$subword_index] = $typeface;
     return $typeface;
 }