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

Document how to embed fonts in FX apps

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • fx2.0
    • fx1.2
    • javafx

      You embed the font along with your application. You load the font by name. Simply place the ttf font file in a package in your application. Then you need to include a fonts.mf file in the META-INF of the jar so that we can discover the embedded fonts at runtime. The fonts.mf file is simply a properties file that lists the name of the font and the location of the font.

      fonts.mf:

      Arindam\ Neo\ Bold = /com/mycompany/fonts/arind.ttf

      for example. Then in code you just load a font by name, using the name that you entered into your fonts.mf:

      Font {
        name: "Arindam Neo Bold"
        size: 27
      }

            prr Philip Race
            rbair Richard Bair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: