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

    return (int) m_glyph.getHead().getAdvanceWidth();
  }
Example #2
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;
  }
Example #3
0
 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
 }
Example #4
0
  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);
  }
Example #5
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;
  }
Example #6
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");
  }
Example #7
0
  public String getGlyphTitle() {
    String retval = "";

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

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

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

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