Package org.odftoolkit.odfdom.dom.element.style

Examples of org.odftoolkit.odfdom.dom.element.style.StyleFontFaceElement


      if (fontfaceDecls == null)
        return null;

      NodeList list = fontfaceDecls.getElementsByTagName("style:font-face");
      for (int i = 0; i < list.getLength(); i++) {
        StyleFontFaceElement node = (StyleFontFaceElement) list.item(i);
        String familyname = node.getSvgFontFamilyAttribute();
        String fontName = node.getStyleNameAttribute();
        if (aFontName.equals(fontName)) {
          return familyname;
        }
      }
    } catch (Exception e) {
View Full Code Here


          fontfaceDecls = contentDom.getRootElement().newOfficeFontFaceDeclsElement();
      }

      NodeList list = fontfaceDecls.getElementsByTagName("style:font-face");
      for (int i = 0; i < list.getLength(); i++) {
        StyleFontFaceElement node = (StyleFontFaceElement) list.item(i);
        String familyname = node.getSvgFontFamilyAttribute();
        String fontName = node.getStyleNameAttribute();
        if (aFamilyName.equals(familyname)) {
          return fontName;
        }
        if (aFontName.equals(fontName)) {
          duplicated = true;
        }
      }

      // Get a font name
      while (duplicated) {
        duplicated = false;
        aFontName = aFontName + "_1";
        for (int i = 0; i < list.getLength(); i++) {
          StyleFontFaceElement node = (StyleFontFaceElement) list.item(i);
          String fontName = node.getStyleNameAttribute();
          if (aFontName.equals(fontName)) {
            duplicated = true;
            break;
          }
        }
      }

      StyleFontFaceElement newfont = fontfaceDecls.newStyleFontFaceElement(aFontName);
      newfont.setSvgFontFamilyAttribute(aFamilyName);
      return aFontName;
    } catch (Exception e) {
      Logger.getLogger(TextProperties.class.getName()).log(Level.SEVERE,  e.getMessage(), e);
    }
    return null;
View Full Code Here

   *
   * @param styleNameValue  the <code>String</code> value of <code>StyleNameAttribute</code>, see {@odf.attribute  style:name} at specification
   * @return the element {@odf.element style:font-face}
   */
   public StyleFontFaceElement newStyleFontFaceElement(String styleNameValue) {
    StyleFontFaceElement styleFontFace = ((OdfFileDom) this.ownerDocument).newOdfElement(StyleFontFaceElement.class);
    styleFontFace.setStyleNameAttribute(styleNameValue);
    this.appendChild(styleFontFace);
    return styleFontFace;
  }
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.style.StyleFontFaceElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.