rect = layout.getPixelBounds(null, x, 0); } else { Rectangle2D.union(rect, layout.getPixelBounds(null, x, 0), rect);
FontRenderContext frc = z.getFontRenderContext(); TextLayout tl = new TextLayout(tokenName, font, frc); Rectangle textbox = tl.getPixelBounds(null, 0, 0);
FontRenderContext frc = new FontRenderContext(null, true, true); TextLayout layout = new TextLayout(label, font, frc); Rectangle r = layout.getPixelBounds(null, 0, 0); System.out.println(r); BufferedImage bi = new BufferedImage(
private void drawMarker(Graphics2D g2, Point location, String title) { // map location to the appropriate corner of the guiding square. Point boxLocation = new Point(location); if (sourceLangIsRTL) { boxLocation.translate(-boxSize, -boxSize); // right-bottom corner } else { boxLocation.translate(0, -boxSize); // left-bottom corner } guidingSquare.setLocation(boxLocation); // create TextLayout TextLayout layout = new TextLayout(title, titleFont, g2.getFontRenderContext()); Rectangle pixelBounds = layout.getPixelBounds(null, location.x, location.y); Dimension diffForCentered = getCenteredDimension(pixelBounds, guidingSquare); // set marker shape's position markerShape.translate(boxLocation.x, boxLocation.y); // fill rectangle g2.setColor(colorScheme.background); g2.fill(markerShape); // draw rectangle g2.setColor(colorScheme.border); g2.draw(markerShape); // hideMarkers position for next time markerShape.translate(-boxLocation.x, -boxLocation.y); // draw title letter g2.setColor(colorScheme.foreground); layout.draw(g2, location.x + diffForCentered.width, location.y + diffForCentered.height); }
Rectangle labelBounds = testText.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width;
Rectangle labelBounds = testText.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width;
Rectangle labelBounds = testText.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(frc, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(frc, 0, 0); labelWidth = labelBounds.width;
Rectangle labelBounds = testText.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(frc, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(frc, 0, 0); labelWidth = labelBounds.width;
labelBounds1 = text1.getPixelBounds(null, 0, 0); if(symStd == RendererSettings.Symbology_2525B) labelBounds1 = text1.getPixelBounds(null, 0, 0); y = symbolBounds.getY() + (symbolBounds.getHeight()/2) + (text1.getAscent()/2); x = symbolBounds.getX() + symbolBounds.getWidth() + bufferXR; labelBounds2 = text2.getPixelBounds(null, 0, 0); labelBounds2 = text2.getPixelBounds(null, 0, 0);
FontRenderContext frc = new FontRenderContext(null, true, true); TextLayout layout = new TextLayout(label, font, frc); Rectangle r = layout.getPixelBounds(null, 0, 0); System.out.println(r); BufferedImage bi = new BufferedImage(
labelBounds1 = text1.getPixelBounds(null, 0, 0); if(symStd == RendererSettings.Symbology_2525B) labelBounds1 = text1.getPixelBounds(null, 0, 0); y = symbolBounds.getY() + (symbolBounds.getHeight()/2) + (text1.getAscent()/2); x = symbolBounds.getX() + symbolBounds.getWidth() + bufferXR; labelBounds2 = text2.getPixelBounds(null, 0, 0); labelBounds2 = text2.getPixelBounds(null, 0, 0);
r = layout.getPixelBounds(null, 0, 0);
Rectangle labelBounds = testText.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0);//not needed for right side labels labelBounds = text.getPixelBounds(null, 0, 0);//not needed for right side labels labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width;
temp = _TextLayout.getPixelBounds(null, (float)_Position.getX(), (float)_Position.getY());
Rectangle labelBounds = testText.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0);//not needed for right side labels labelBounds = text.getPixelBounds(null, 0, 0);//not needed for right side labels labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width; labelBounds = text.getPixelBounds(null, 0, 0); labelWidth = labelBounds.width;
Rectangle labelBounds = text.getPixelBounds(null, 0, 0);
Rectangle labelBounds = text.getPixelBounds(null, 0, 0);
tempRect = originalText.getTextLayout().getPixelBounds(null, (float)originalText.getGlyphPosition().getX(), (float)originalText.getGlyphPosition().getY());