示例#1
0
  /** Generates array of XContour from local contours and modules. Used for TTF building. */
  private XContour[] toContours() {
    XContour[] retval;
    ArrayList<XContour> list = new ArrayList<>();
    XContour[] contours = m_glyph.getBody().getContour();
    for (int i = 0; i < contours.length; i++) {
      EContour contour = (EContour) contours[i];
      list.add(contour.toQuadratic());
    } // for i

    XModule[] modules = m_glyph.getBody().getModule();
    for (int i = 0; i < modules.length; i++) {
      EModuleInvoke module = (EModuleInvoke) modules[i];

      // push and pop happens inside toContour
      list.add(module.toContour(new AffineTransform()));
    } // for i

    if (list.size() == 0) return null;

    retval = new XContour[list.size()];
    for (int i = 0; i < list.size(); i++) {
      retval[i] = list.get(i);
    } // for i

    return retval;
  }
示例#2
0
  /**
   * pasted module from clipboard or ModuleInvokeAction
   *
   * @param a_module
   */
  public XModule addModule(EModuleInvoke a_module) {
    m_actives.unselectAll();
    m_actives.addActive(a_module);
    m_glyph.getBody().addModule(a_module);
    m_history.record("addModule");

    return a_module;
  }
示例#3
0
  public void addInclude(XInclude a_include) throws CircularIncludeException {
    if (isCircularInclude(a_include.getHref())) {
      throw new CircularIncludeException();
    } // if

    m_actives.unselectAll();
    m_actives.addActive((GlyphObject) a_include);
    m_glyph.getBody().addInclude(a_include);
    m_history.record("addInclude");
  }
示例#4
0
  private boolean isCircularInclude(String a_href) {
    if (getShortFileName().equals(a_href)) {
      return true;
    } // if

    ModuleManager manager = ModuleManager.getSingletonInstance();
    XInclude[] includes = m_glyph.getBody().getInclude();
    int i;
    for (i = 0; i < includes.length; i++) {
      XInclude include = includes[i];
      GlyphFile child = manager.getGlyphFile(include.getHref());

      if (child.isCircularInclude(a_href)) {
        return true;
      } // if
    } // for i

    return false;
  }
示例#5
0
 public boolean isSimple() {
   return (m_glyph.getBody().getInclude().length == 0);
 }
示例#6
0
 /**
  * add contour from clipboard or ContourAction
  *
  * @param a_contour
  */
 public void addContour(EContour a_contour) {
   m_actives.unselectAll();
   m_actives.addActive(a_contour);
   m_glyph.getBody().addContour(a_contour);
   m_history.record("addContour");
 }