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

CSS: FX handling of font attribute different than HTML

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • None
    • javafx
    • None

      See the following example:

      .child1 {
      font-weight: bold;
      font: 48pt Tahoma;
      }

      .child2 {
      font: 48pt Tahoma;
      font-weight: bold;
      }

      in HTML:
      a node styled with child1 is 'Regular' 48pt Tahoma
      a node styled with child2 is 'Bold' 48pt Tahoma


      In JFX this case works opposite
      .child1 {
      -fx-font-weight: bold;
      -fx-font: 48pt 'Tahoma';
      }

      .child2 {
      -fx-font: 48pt 'Tahoma';
      -fx-font-weight: bold;
      }

      a node styled with child1 is 'Bold' 48pt Tahoma
      a node styled with child2 is 'Regular' 48pt Tahoma


      I believe the way this works:
      a) font: 48pt Tahoma; expands to
      font-style: normal;
      font-variant: normal;
      font-weight: normal;
      font-size: 48pt;
      font-family: Tahoma;

      Replacing this in the first intance of child1 we have:
      .child1 {
      font-weight: bold;
      font-style: normal;
      font-variant: normal;
      font-weight: normal;
      font-size: 48pt;
      font-family: Tahoma;
      }

      b) the last attribute set in the class definition overrides the rest



      thus, HTML is right (tested on chrome and firefox), JFX is wrong

            dgrieve David Grieve
            fheidric Felipe Heidrich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: