Logo Search packages:      
Sourcecode: acidbase version File versions  Download package

Cpdf::o_font ( id,
action,
options = '' 
)

an object to hold the font description

Definition at line 475 of file class.pdf.php.

References $options, addMessage(), o_fontEncoding(), and o_pages().

Referenced by selectFont().

                                        {
  if ($action!='new'){
    $o =& $this->objects[$id];
  }
  switch ($action){
    case 'new':
      $this->objects[$id]=array('t'=>'font','info'=>array('name'=>$options['name'],'SubType'=>'Type1'));
      $fontNum=$this->numFonts;
      $this->objects[$id]['info']['fontNum']=$fontNum;
      // deal with the encoding and the differences
      if (isset($options['differences'])){
        // then we'll need an encoding dictionary
        $this->numObj++;
        $this->o_fontEncoding($this->numObj,'new',$options);
        $this->objects[$id]['info']['encodingDictionary']=$this->numObj;
      } else if (isset($options['encoding'])){
        // we can specify encoding here
        switch($options['encoding']){
          case 'WinAnsiEncoding':
          case 'MacRomanEncoding':
          case 'MacExpertEncoding':
            $this->objects[$id]['info']['encoding']=$options['encoding'];
            break;
          case 'none':
            break;
          default:
            $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
            break;
        }
      } else {
        $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
      }
      // also tell the pages node about the new font
      $this->o_pages($this->currentNode,'font',array('fontNum'=>$fontNum,'objNum'=>$id));
      break;
    case 'add':
      foreach ($options as $k=>$v){
        switch ($k){
          case 'BaseFont':
            $o['info']['name'] = $v;
            break;
          case 'FirstChar':
          case 'LastChar':
          case 'Widths':
          case 'FontDescriptor':
          case 'SubType':
          $this->addMessage('o_font '.$k." : ".$v);
            $o['info'][$k] = $v;
            break;
        }
     }
      break;
    case 'out':
      $res="\n".$id." 0 obj\n<< /Type /Font\n/Subtype /".$o['info']['SubType']."\n";
      $res.="/Name /F".$o['info']['fontNum']."\n";
      $res.="/BaseFont /".$o['info']['name']."\n";
      if (isset($o['info']['encodingDictionary'])){
        // then place a reference to the dictionary
        $res.="/Encoding ".$o['info']['encodingDictionary']." 0 R\n";
      } else if (isset($o['info']['encoding'])){
        // use the specified encoding
        $res.="/Encoding /".$o['info']['encoding']."\n";
      }
      if (isset($o['info']['FirstChar'])){
        $res.="/FirstChar ".$o['info']['FirstChar']."\n";
      }
      if (isset($o['info']['LastChar'])){
        $res.="/LastChar ".$o['info']['LastChar']."\n";
      }
      if (isset($o['info']['Widths'])){
        $res.="/Widths ".$o['info']['Widths']." 0 R\n";
      }
      if (isset($o['info']['FontDescriptor'])){
        $res.="/FontDescriptor ".$o['info']['FontDescriptor']." 0 R\n";
      }
      $res.=">>\nendobj";
      return $res;
      break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index