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

Cpdf::setCurrentFont (  )

sets up the current font, based on the font families, and the current text state note that this system is quite flexible, a font can be completely different to a font, and even will have to be defined within the family to have meaning This function is to be called whenever the currentTextState is changed, it will update the currentFont setting to whatever the appropriatte family one is. If the user calls selectFont themselves then that will reset the currentBaseFont, and the currentFont This function will change the currentFont to whatever it should be, but will not change the currentBaseFont.

private

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

References selectFont().

Referenced by addText(), addTextWrap(), getTextWidth(), and selectFont().

                         {
  if (strlen($this->currentBaseFont)==0){
    // then assume an initial font
    $this->selectFont('./fonts/Helvetica.afm');
  }
  $cf = substr($this->currentBaseFont,strrpos($this->currentBaseFont,'/')+1);
  if (strlen($this->currentTextState)
    && isset($this->fontFamilies[$cf]) 
      && isset($this->fontFamilies[$cf][$this->currentTextState])){
    // then we are in some state or another
    // and this font has a family, and the current setting exists within it
    // select the font, then return it
    $nf = substr($this->currentBaseFont,0,strrpos($this->currentBaseFont,'/')+1).$this->fontFamilies[$cf][$this->currentTextState];
    $this->selectFont($nf,'',0);
    $this->currentFont = $nf;
    $this->currentFontNum = $this->fonts[$nf]['fontNum'];
  } else {
    // the this font must not have the right family member for the current state
    // simply assume the base font
    $this->currentFont = $this->currentBaseFont;
    $this->currentFontNum = $this->fonts[$this->currentFont]['fontNum'];    
  }
}

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