Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4311203

deriveFont does not use floats, it uses int values

XMLWordPrintable

    • 2d
    • x86
    • solaris_2.5

      > System: WindowsNT 4.0 (Build 1381: Sevice Pack 5)
      >
      > Java Version : Classic VM (build JDK-1.2.2-001, native threads,
      > symcjit)
      >
      >
      > AND
      >
      > Java(TM) 2 Runtime Environment, Standard
      > Edition (build 1.3.0-R)
      > Java HotSpot(TM) Client VM (build 1.3-R,
      > mixed mode)
      >
      >
      >
      > Location: in java.awt.Font (or underllying classes)
      >
      > Example: An example is attached to this mail
      >
      >
      > Description:
      >
      > Java java.awt.Font class owns two methods
      >
      > public Font deriveFont(int style, float size)
      >
      > public Font deriveFont(float size)
      >
      > which should be able to create a Font object (from an existing Font
      > object) with the specified font size (float value).
      > The attached example shows that this doesn't work. Instead the method
      > returns a Font object with an int adjusted size:
      >
      > 1. Start the example and increase fonts point size from 11 points by 0.1
      > point steps with the JComboBox in the middle of control pane (between
      > font-style combobox and the zoom combo box). The size of the drawn string
      > persists until the point size changes from 11.4 to 11.5 and than skips to
      > 12 point size.
      >
      > Is there any possibility to derive fonts with a size other than int
      > values?
      >
      > 2. The described problem occurs when you perform an AffineTransform of the
      > underlying Graphic2D-Object too:
      > In the same example set the point size to 11.0. Than change the zoom size
      > of the AffineTransform with the combobox on the right hand of the point
      > size box from 1.0 by 0.01 steps. You will see that the size of the String
      > persists until the zoom is changes from 1.04 to 1.05 an then skips to the
      > next bigger size, while the drawn lines change their size an position
      > according to the values in the combobox.
      >
      > 3. The same problem occurs when printing graphics and text to printers
      > with different resolutions. Because Java2D uses AffineTransform to
      > accomplish drawing on devices with different resolution the results are
      > different for every resolution. (no example)

            dougfelt Doug Felt
            pmaier Peter Maier (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: