Esempio n. 1
0
  private void loadHint(TTGlyph a_glyph, EContourPoint a_point, int a_index) {
    double x = a_point.getX();
    double y = a_point.getY();

    XHint[] hints = a_point.getHint();

    for (int i = 0; i < hints.length; i++) {
      EHint hint = (EHint) hints[i];
      double xHint = hint.getX();
      double yHint = hint.getY();

      if (x == xHint && y == yHint) {
        continue;
      } // if

      double xDelta = xHint - x;
      double yDelta = yHint - y;
      int instruction = TTGlyph.DELTAP1;
      double deltaStep = ((double) Engine.getEm()) / hint.getPpem() / 8;
      int xShift = (int) Math.round(xDelta / deltaStep);
      int yShift = (int) Math.round(yDelta / deltaStep);

      if (xShift == 0 && yShift == 0) {
        continue;
      } // if

      a_glyph.addInstruction(TTGlyph.PUSHB000);
      a_glyph.addInstruction((int) hint.getPpem());
      a_glyph.addInstruction(TTGlyph.SDB);

      if (xShift != 0) {
        a_glyph.addInstruction(TTGlyph.SVTCA1);
        a_glyph.addInstruction(TTGlyph.PUSHB010);
        a_glyph.addInstruction(TTGlyph.toDeltaArg(0, xShift));
        a_glyph.addInstruction(a_index);
        a_glyph.addInstruction(1);
        a_glyph.addInstruction(TTGlyph.DELTAP1);
      } // if

      if (yShift != 0) {
        a_glyph.addInstruction(TTGlyph.SVTCA0);
        a_glyph.addInstruction(TTGlyph.PUSHB010);
        a_glyph.addInstruction(TTGlyph.toDeltaArg(0, yShift));
        a_glyph.addInstruction(a_index);
        a_glyph.addInstruction(1);
        a_glyph.addInstruction(TTGlyph.DELTAP1);
      } // if
    } // for i
  }
Esempio n. 2
0
  public void buildPointHost() {
    m_pointHost = null;

    /*if (!GlyphAction.isPointVisible()) {
        return;
    } // if*/

    int i;
    for (i = 0; i < m_actives.size(); i++) {
      GlyphObject object = (GlyphObject) m_actives.get(i);
      PointAggregate host = null;

      if (object instanceof EContourPoint) {
        EContourPoint point = (EContourPoint) object;
        host = point.getParent();

        if (host instanceof EContourPoint) {
          EContourPoint hostPoint = (EContourPoint) host;
          host = hostPoint.getParent();
        } // if
      } else if (object instanceof EHint) {
        EHint hint = (EHint) object;
        host = hint.getPointHost();
      } // if-else

      if (host == null) {
        continue;
      } // if

      if (m_pointHost == null) {
        m_pointHost = host;
      } else {
        if (m_pointHost != host) {
          m_pointHost = null;
          return;
        } // if
      } // if
    } // while
  }