コード例 #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
  public void convertContour() {
    if (!m_actives.hasActiveContour()) {
      return;
    } // if

    EContour contour = m_actives.getActiveContour();
    contour.convert();

    m_history.record("convertContour");
  }
コード例 #3
0
  /** initialize .notdef */
  public void initNotDef(int a_advanceWidth) throws FileNotFoundException {
    setAdvanceWidth(a_advanceWidth);

    EContour contour = new EContour();
    contour.setType(EContour.k_cubic);
    contour.addContourPoint(new EContourPoint(0.0, 0.0, true));
    contour.addContourPoint(new EContourPoint(438.0, 0.0, true));
    contour.addContourPoint(new EContourPoint(438.0, 683.0, true));
    contour.addContourPoint(new EContourPoint(0.0, 683.0, true));
    addContour(contour);

    contour = new EContour();
    contour.setType(EContour.k_cubic);
    contour.addContourPoint(new EContourPoint(365.0, 73.0, true));
    contour.addContourPoint(new EContourPoint(73.0, 73.0, true));
    contour.addContourPoint(new EContourPoint(73.0, 610.0, true));
    contour.addContourPoint(new EContourPoint(365.0, 610.0, true));
    addContour(contour);

    saveGlyphFile();
  }