src/main/java/com/mxgraph/canvas/mxGraphicsCanvas2D.java
protected final Graphics2D createTextGraphics(double x, double y, double w,
			double h, double rotation, boolean clip, String align,
			String valign)
	{
		Graphics2D g2 = state.g;
		updateFont();

		if (rotation != 0)
		{
			g2 = (Graphics2D) state.g.create();

			double rad = rotation * (Math.PI / 180);
			g2.rotate(rad, x, y);
		}

		if (clip && w > 0 && h > 0)
		{
			if (g2 == state.g)
			{
				g2 = (Graphics2D) state.g.create();
			}

			Point2D margin = getMargin(align, valign);
			x += margin.getX() * w;
			y += margin.getY() * h;

			g2.clip(new Rectangle2D.Double(x, y, w, h));
		}

		return g2;
	}
/**
	 * Returns a new graphics instance with the correct color and font for
	 * text rendering.
	 */
Returns a new graphics instance with the correct color and font for
text rendering.
Returns a new graphics instance with the correct color and font for text rendering .
protected final Graphics2D createTextGraphics(double x, double y, double w,
			double h, double rotation, boolean clip, String align,
			String valign)
	{
		Graphics2D g2 = state.g;
		updateFont();
		if (rotation != 0)
		{
			g2 = (Graphics2D) state.g.create();
			double rad = rotation * (Math.PI / 180);
			g2.rotate(rad, x, y);
		}
		if (clip && w > 0 && h > 0)
		{
			if (g2 == state.g)
			{
				g2 = (Graphics2D) state.g.create();
			}
			Point2D margin = getMargin(align, valign);
			x += margin.getX() * w;
			y += margin.getY() * h;
			g2.clip(new Rectangle2D.Double(x, y, w, h));
		}
		return g2;
	}
protected final Graphics2D createTextGraphics ( double x , double y , double w , double h , double rotation , boolean clip , String align , String valign ) { Graphics2D g2 = state . g ; updateFont ( ) ; if ( rotation != 0 ) { g2 = ( Graphics2D ) state . g . create ( ) ; double rad = rotation * ( Math . PI / 180 ) ; g2 . rotate ( rad , x , y ) ; } if ( clip && w > 0 && h > 0 ) { if ( g2 == state . g ) { g2 = ( Graphics2D ) state . g . create ( ) ; } Point2D margin = getMargin ( align , valign ) ; x += margin . getX ( ) * w ; y += margin . getY ( ) * h ; g2 . clip ( new Rectangle2D . Double ( x , y , w , h ) ) ; } return g2 ; }
Returns a new graphics instance with the correct color and font for
 text rendering.
Returns a new graphics instance with the correct color and font for text rendering .