Пример #1
0
  private boolean addAtEmbed(AtEmbed atEmbed) {
    if (mxmlDocument != null) {
      mxmlDocument.addAtEmbed(atEmbed);
    } else if (!atEmbeds.containsKey(atEmbed.getPropName())) {
      atEmbeds.put(atEmbed.getPropName(), atEmbed);
    }

    return true;
  }
Пример #2
0
  public void addFontFaceRule(FontFaceRule rule) {
    assert rule != null;

    String family = rule.getFamily();
    boolean bold = rule.isBold();
    boolean italic = rule.isItalic();

    if (getFontFaceRule(family, bold, italic) == null) {
      fontFaceRules.add(rule);

      //    add embed for font
      String propName =
          "_embed__font_"
              + family
              + "_"
              + (bold ? "bold" : "medium")
              + "_"
              + (italic ? "italic" : "normal");
      Map embedParams = rule.getEmbedParams();
      StyleDeclaration styleDeclaration = rule.getStyle();
      String path = styleDeclaration.getPath();

      if (path.indexOf('\\') > -1) {
        embedParams.put(Transcoder.FILE, path.replace('\\', '/'));
        embedParams.put(Transcoder.PATHSEP, "true");
      } else {
        embedParams.put(Transcoder.FILE, path);
      }

      embedParams.put(Transcoder.LINE, Integer.toString(styleDeclaration.getLineNumber()));
      AtEmbed atEmbed =
          AtEmbed.create(propName, rule.getStyle().getLineNumber(), embedParams, false);
      addAtEmbed(atEmbed);
    } else if (Trace.font) {
      Trace.trace(
          "Font face already existed for " + family + " bold? " + bold + " italic? " + italic);
    }
  }