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

CSS parser can read all the font related properties, except for some font-family

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Garuda Linux (Arch) x86_64
      OpenJDK version "20.0.1"

      A DESCRIPTION OF THE PROBLEM :
      I have a series of TTF fonts which are imported in CSS with the @font-face keyword. However, I noticed that JavaFX fails to load the font-family. Strangely, all other properties such as the font size and text fill are correctly parsed.
      The only way to set the desired font is to load it via code, but it's not really feasible for devs who are writing themes. Can someone look into this please? I already prepared an MRE project.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just run the MRE project, clicking on the buttons will print in the console the current font for the buttons
      Also, since I was experiencing the issue in a custom popup I was implementing, I reproduced that too.
      But then I realized it was not the popup's fault as the issue was presenting on buttons too

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      JavaFX CSS parser should be capable of reading @font-face directives and load the correct font rather than defaulting to the System font
      ACTUAL -
      The CSS parser can read all the font related properties correctly except for the font-family one, leading to the incorrect font being applied

      ---------- BEGIN SOURCE ----------
      Here's the link to the project on my Dropbox: <link>
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The only workaround I found is to force set the font via code, but it's not really feasible when the context is theming entire Apps

      FREQUENCY : always

        1. Notworking_Capture.JPG
          Notworking_Capture.JPG
          164 kB
        2. TestApp.zip
          843 kB
        3. Working_capture.JPG
          Working_capture.JPG
          113 kB

            angorya Andy Goryachev
            pnarayanaswa Praveen Narayanaswamy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: