Package com.adobe.dp.css

Examples of com.adobe.dp.css.CSSStylesheet


  CSSStylesheet css;

  public Stylesheet(StyleResource owner) {
    this.owner = owner;
    css = new CSSStylesheet();
  }
View Full Code Here


    if (uri.equals(OPSDocument.xhtmlns)) {
      if (localName.equals("style")) {
        CSSParser parser = new CSSParser();
        parser.setCSSURLFactory(new EPUBCSSURLFactory(document.resource));
        try {
          CSSStylesheet css = parser.readStylesheet(new StringReader(content));
          String inlineName = PathUtil.resolveRelativeReference(document.resource.getName(), "inline.css");
          StyleResource sr = epub.createStyleResource(inlineName);
          sr.setCSS(css);
          document.addStyleResource(sr.getResourceRef());
        } catch (IOException e) {
View Full Code Here

      Resource r = ref.getResource();
      if (r instanceof StyleResource) {
        StyleResource sr = (StyleResource) r;
        Stylesheet stylesheet = sr.getStylesheet();
        if (stylesheet != null) {
          CSSStylesheet css = stylesheet.getCSS();
          if (css != null)
            engine.add(css, null);
        }
      }
    }
View Full Code Here

  void init(Vector names) throws IOException {
    Enumeration entries = names.elements();
    HashSet fonts = new HashSet();
    Hashtable fontMap = new Hashtable();
    CSSStylesheet stylesheet = null;
    while (entries.hasMoreElements()) {
      String name = entries.nextElement().toString();
      String lname = name.toLowerCase();
      if (lname.endsWith(".css")) {
        InputStream in = getInputStream(name);
        if (stylesheet == null)
          stylesheet = new CSSStylesheet();
        CSSParser parser = new CSSParser();
        parser.readStylesheet(in, stylesheet);
        in.close();
      } else if (lname.endsWith(".ttf") || lname.endsWith(".otf") || lname.endsWith(".ttc")) {
        fonts.add(name);
      }
    }

    Iterator stmts = stylesheet.statements();
    while (stmts.hasNext()) {
      Object stmt = stmts.next();
      if (stmt instanceof FontFaceRule) {
        Object src = ((FontFaceRule) stmt).get("src");
        if (src instanceof CSSURL) {
View Full Code Here

  }
 
  public void load(DataSource data) throws IOException {
    CSSParser parser = new CSSParser();
    parser.setCSSURLFactory(new EPUBCSSURLFactory(this));
    CSSStylesheet css = parser.readStylesheet(data.getInputStream());
    stylesheet = new Stylesheet(this, css);
  }
View Full Code Here

TOP

Related Classes of com.adobe.dp.css.CSSStylesheet

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.