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

Changing font size messes with font family

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 8
    • 8
    • javafx

      main.css:

      .root {
          /* Fonts */
          -fx-font-family: serif;
          -fx-font-size: 15pt;
      }

      => Font family is serif

      But when I change the font-size of my text, the font family is overriden/returns to the system default (a non-serifed font).

      http://imageshack.us/scaled/thumb/818/4gi5.png => the Text in the middle should still be serifed, only smaller.

      FontTest.scala:

      package fonttest

      import scala.collection.JavaConverters._
      import scalafx.Includes._

      import scalafx.application.JFXApp
      import scalafx.scene.Scene
      import scalafx.stage.Stage
      import scalafx.scene.layout.VBox
      import scalafx.scene.text.Text

      object FontTest extends JFXApp {

        stage = new JFXApp.PrimaryStage {
        
          width = 600
          height = 450
          
          scene = new Scene {
          
          stylesheets = Set("main.css")

            content = Set(new VBox {
                
                content = Set(
                
                  new Text("Font"),
                  
                  new Text("Font") {
                    style = "-fx-font-size: 11px;" // <= should be smaller, but still serifed like others
                  },
                  
                  new Text("Font")
                )
              }
            )
          }
        }
      }

      https://docs.google.com/file/d/0B7lrDAvzeFVySmZ5Q2VxQlVEUE0/edit?usp=sharing => for the minimal source code + gradle build.

            dgrieve David Grieve
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: