public void setPosition(int index,double x, double y ){ vectors.get(index).setGlyphPosition(0,new Point2D.Double(x,y)); }
@Override public void setGlyphPosition(int arg0, Point2D arg1) { if (arg0 == this.getNumGlyphs()) return; this.vec.setGlyphPosition(arg0, arg1); }
public static void adjust(GlyphVector gv){ // calc the adjust Factor int adjust = (int)Math.round(gv.getGlyphVisualBounds(0).getBounds2D().getMinX()); // Shift all the Glyphs in Vector for (int i = 0; i < gv.getNumGlyphs(); i++) { Point2D point = gv.getGlyphPosition(i); gv.setGlyphPosition( i, new Point2D.Double( point.getX() - adjust, point.getY())); } }
private void adjustGlyphPositions( String string, JustificationInfo info, GlyphVector vector) { float adjust = 0.0f; for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (i != 0) { Point2D point = vector.getGlyphPosition(i); vector.setGlyphPosition( i, new Point2D.Double(point.getX() + adjust, point.getY())); } if (c == ' ' || c == '\u00a0' || c == '\u3000') { adjust += info.getSpaceAdjust(); } else { adjust += info.getNonSpaceAdjust(); } } }
private void adjustGlyphPositions( String string, JustificationInfo info, GlyphVector vector) { float adjust = 0.0f; for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (i != 0) { Point2D point = vector.getGlyphPosition(i); vector.setGlyphPosition( i, new Point2D.Double(point.getX() + adjust, point.getY())); } if (c == ' ' || c == '\u00a0' || c == '\u3000') { adjust += info.getSpaceAdjust(); } else { adjust += info.getNonSpaceAdjust(); } } }
private void adjustGlyphPositions( String string, JustificationInfo info, GlyphVector vector) { float adjust = 0.0f; for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (i != 0) { Point2D point = vector.getGlyphPosition(i); vector.setGlyphPosition( i, new Point2D.Double(point.getX() + adjust, point.getY())); } if (c == ' ' || c == '\u00a0' || c == '\u3000') { adjust += info.getSpaceAdjust(); } else { adjust += info.getNonSpaceAdjust(); } } }
private void adjustGlyphPositions( String string, JustificationInfo info, GlyphVector vector) { float adjust = 0.0f; for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (i != 0) { Point2D point = vector.getGlyphPosition(i); vector.setGlyphPosition( i, new Point2D.Double(point.getX() + adjust, point.getY())); } if (c == ' ' || c == '\u00a0' || c == '\u3000') { adjust += info.getSpaceAdjust(); } else { adjust += info.getNonSpaceAdjust(); } } }
* (rnd.nextDouble() / 20 + (rotateEnabled ? 0.27 : 0.1)), pos.getY()); v.setGlyphPosition(fi, newPos); prePos = newPos; preBounds = v.getGlyphVisualBounds(fi).getBounds2D();
public Shape getEstringOutline(String displayText, float x, float y) { displayText = toUnicode(displayText); FontRenderContext frc = new FontRenderContext(new AffineTransform(), true, true); GlyphVector glyphVector = awtFont.createGlyphVector(frc, displayText); glyphVector.setGlyphPosition(0, new Point2D.Float(x, y)); // Iterate through displayText to calculate the the new advance value if // the displayLength is greater then one character. This in sures that // cid -> String will get displayed correctly. int displayLength = displayText.length(); float lastx; if (displayLength > 1) { Point2D p; float advance = 0; for (int i = 0; i < displayText.length(); i++) { // Position of the specified glyph relative to the origin of glyphVector p = glyphVector.getGlyphPosition(i); lastx = (float) p.getX(); // add fonts rise to the to glyph position (sup,sub scripts) glyphVector.setGlyphPosition( i, new Point2D.Double(lastx + advance, p.getY())); // subtract the advance because we will be getting it from the fonts width float adv1 = glyphVector.getGlyphMetrics(i).getAdvance(); double adv2 = echarAdvance(displayText.charAt(i)).getX(); advance += -adv1 + adv2 + lastx; } } return glyphVector.getOutline(); }
Point2D point = gv.getGlyphPosition(i); point.setLocation(point.getX() + i * intercharSpace, point.getY()); gv.setGlyphPosition(i, point); if (DEBUG) { System.out.println(i + " " + point
awtGlyphVector.setGlyphPosition(i, pos); awtGlyphVector.setGlyphTransform(i, at); awtGlyphVector.setGlyphPosition(i, pos); awtGlyphVector.setGlyphTransform(i, null);
awtGlyphVector.setGlyphPosition(i, pos); awtGlyphVector.setGlyphTransform(i, at); awtGlyphVector.setGlyphPosition(i, pos); awtGlyphVector.setGlyphTransform(i, null);
awtGlyphVector.setGlyphPosition(i, pos); awtGlyphVector.setGlyphTransform(i, at); awtGlyphVector.setGlyphPosition(i, pos); awtGlyphVector.setGlyphTransform(i, null);
gv.setGlyphPosition(0, cursor); gv.setGlyphPosition(++currentIdx, cursor);
Point2D pt = gv.getGlyphPosition(i); pt.setLocation(cursor, pt.getY()); gv.setGlyphPosition(i, pt); cursor += offsets[i] / 1000f;
vector.setGlyphPosition(i, new Point2D.Float(-100000, -100000)); vector.setGlyphPosition(i, new Point2D.Float(-100000, -100000)); if (i != 0) { Point2D point = vector.getGlyphPosition(i); vector.setGlyphPosition( i, new Point2D.Double(point.getX() + adjust, point.getY()));
vector.setGlyphPosition(i, new Point2D.Float(-100000, -100000)); vector.setGlyphPosition(i, new Point2D.Float(-100000, -100000)); if (i != 0) { Point2D point = vector.getGlyphPosition(i); vector.setGlyphPosition( i, new Point2D.Double(point.getX() + adjust, point.getY()));
vector.setGlyphPosition(i, new Point2D.Float(-100000, -100000)); vector.setGlyphPosition(i, new Point2D.Float(-100000, -100000)); if (i != 0) { Point2D point = vector.getGlyphPosition(i); vector.setGlyphPosition( i, new Point2D.Double(point.getX() + adjust, point.getY()));