private void loadContourPoint(TTGlyph a_glyph, EContourPoint a_point) { double x = a_point.getX(); double y = a_point.getY(); Point p = new Point((int) x, (int) y); int flag = 0; if (a_point.isOn()) { flag = TTGlyph.k_onCurve; } // if a_glyph.addPoint(p); a_glyph.addFlag(flag); }
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 }