public int getAdvanceWidth() {
    if (!m_glyph.getHead().checkAdvanceWidth()) {
      setAdvanceWidth(k_halfWidth);
    } // if

    return (int) m_glyph.getHead().getAdvanceWidth();
  }
  /** 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;
  }
 private void loadVar() {
   XParamListParam[] params = m_glyph.getHead().getHeadGlobal().getParamListParam();
   int i;
   for (i = 0; i < params.length; i++) {
     XParamListParam param = params[i];
     addVar(param.getName(), param.getContent());
   } // for i
 }
  public void addFileVar() {
    XParamListParam param = new XParamListParam();
    param.setName("New parameter");
    param.setContent(0.0);
    m_history.record("addFileVar");

    m_glyph.getHead().getHeadGlobal().addParamListParam(param);
  }
  /**
   * 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;
  }
  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");
  }
  public String getGlyphTitle() {
    String retval = "";

    retval = m_glyph.getHead().getTitle();

    if (retval.equals("empty")) {
      retval = "";
    } // if

    return retval;
  }
  public void saveGlyphFile(OutputStream a_output) {
    try {
      Transformer transformer = getTransformer();
      Document document = m_glyph.makeDocument();
      DOMSource source = new DOMSource(document);
      StreamResult result = new StreamResult(a_output);
      transformer.transform(source, result);
    } catch (ParserConfigurationException | TransformerException e) {
      e.printStackTrace();
    }

    m_savedTime = System.currentTimeMillis();
    m_modifiedTime = m_savedTime;
  }
  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;
  }
Beispiel #10
0
 public String getLicense() {
   return m_glyph.getHead().getLicense();
 }
Beispiel #11
0
 public void setLicense(String a_value) {
   m_glyph.getHead().setLicense(a_value);
   m_history.record("setLicense");
 }
Beispiel #12
0
 public boolean isSimple() {
   return (m_glyph.getBody().getInclude().length == 0);
 }
Beispiel #13
0
 protected void setUnicode(String a_unicode) {
   m_glyph.getHead().setUnicode(a_unicode);
   m_history.record("setUnicode");
 }
Beispiel #14
0
 public String getUnicodeAsString() {
   return m_glyph.getHead().getUnicode();
 }
Beispiel #15
0
 public void setAuthor(String a_value) {
   m_glyph.getHead().setAuthor(a_value);
   m_history.record("setAuthor");
 }
Beispiel #16
0
 public void setGlyphTitle(String a_title) {
   m_glyph.getHead().setTitle(a_title);
   m_history.record("setGlyphTitle");
 }
Beispiel #17
0
  public void removeFileVar(int a_index) {
    m_history.record("removeFileVar");

    m_glyph.getHead().getHeadGlobal().removeParamListParam(a_index);
  }
Beispiel #18
0
 public String getAuthor() {
   return m_glyph.getHead().getAuthor();
 }
Beispiel #19
0
 public void setCopyrightYear(String a_value) {
   m_glyph.getHead().setCopyright(a_value);
   m_history.record("setCopyrightYear");
 }
Beispiel #20
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");
 }
Beispiel #21
0
 public Memento createMemento(String a_description) {
   m_modifiedTime = System.currentTimeMillis();
   byte[] bytes = m_glyph.makeTextDocument().getBytes();
   return new Memento(a_description, bytes);
 }
Beispiel #22
0
 public String getCopyrightYear() {
   return m_glyph.getHead().getCopyright();
 }
Beispiel #23
0
 public void setAdvanceWidth(int a_width) {
   m_glyph.getHead().setAdvanceWidth(a_width);
   m_history.record("setAdvanceWidth");
 }