示例#1
0
 /**
  * Checks if the font is already registered or creates a new declaration.
  *
  * Checks if the given $fontFamily is already registered in $fontFaceDecls. 
  * If it is, it's generic font-name is returned. Otherwise a new font face 
  * declaration is created and the chosen font-name is returned.
  * 
  * @param DOMElement $fontFaceDecls 
  * @param string $fontFamily 
  * @return string
  */
 protected function registerFont(DOMElement $fontFaceDecls, $fontFamily)
 {
     $existingFonts = $fontFaceDecls->getElementsByTagnameNS(ezcDocumentOdt::NS_ODT_STYLE, 'font-face');
     foreach ($existingFonts as $fontDecl) {
         if ($fontDecl->getAttributeNS(ezcDocumentOdt::NS_ODT_STYLE, 'name') == $fontFamily) {
             return $fontDecl->getAttributeNS(ezcDocumentOdt::NS_ODT_STYLE, 'name');
         }
     }
     return $this->createNewFontDecl($fontFaceDecls, $fontFamily);
 }