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

Set correct system font size on Embedded

XMLWordPrintable

      The size of controls in JavaFX depends on the system default font see below documentation. For embedded we need to determine this size based on the screen size and DPI that the hardware reports. It also makes sense to factor in if the device is touch or not as a touch device will need to make sure a Button is finger sized. On Windows and Mac we get the font size from the OS but on embedded we will need to calculate it ourselves.


      RESIZING FOR DIFFERNT SCEEN DPI
      -------------------------------

      When the screen DPI changes Windows will use a different font size be default.
      The default is 12px and the can change to 15px or 18px depending on user
      preference or screen DPI. On Mac the default is 13px and embedded will depend
      on hardware. To make UI controls scale and be the right proportions of each of
      these font sizes we base the padding (which controls size of control) on the
      font size. This is done using the CSS measurement unit of a "em" where
      (1em = font size). The default sizes are based on Windows default of 12px, as
      a quick reference here are common px sizes in em units on windows.

           1px = 0.083333em
           2px = 0.166667em
           3px = 0.25em
           4px = 0.333333em
           5px = 0.416667em
           6px = 0.5em
           7px = 0.583333em
           8px = 0.666667em
           9px = 0.75em
          10px = 0.833333em
          11px = 0.916667em
          12px = 1em

      IMPORTANT: Not all sizes are scaled with em units only padding. All borders and
      background insets are still in pixels. Also any padding where it has to match up
      is being used to size a border should also be in pixels.

            dblaukop Daniel Blaukopf (Inactive)
            jasper Jasper Potts (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: