java - Graphics2D - Text is HUGE in scaled coordinate space -


The first "Foo" is normal, but the second one is so big that I can only see the basis of "F". Font-size is default.

  BufferedImage image = new BufferedImage (500, 500, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics (); Size oval = new oval 2D Double (0, 1.0, 1.0, 1.0); G2.setPaint (Color.RED); G2.drawString ("foo", 100, 100); G2.scale (500.0 f / height, 500.0 f / height); G2.drawString ("foo", 1, 1);  

Changing the font size will not help because it only allows to measure the size and size of int which is 0.02 .

I need to draw text in the scaled space, because I am portraying the grid of nodes and I want to scale the coordinates for the number of nodes in each dimension. In this way I do not need to make complicated calculations.

I need text to label edges.

Update: I am able to get the text every time I want to draw text: save the transformation, translate it to the desired location in the scaled space, unsale, text Draw to (0, 0) ,.

You can use the font method

  public font deriveFont (Float size)  

To get the desired font size font, think that 0.02 is okay.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -