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

@font-face doesn't support relative URLs

XMLWordPrintable

      @font-face like below will not font the font file relative to the CSS file location like other CSS urls do.

      @font-face {
          font-family: AFont;
          src: url('fonts/AFontFile.ttf');
      }


      In StyleManager line 918 there is
                  // load any fonts from @font-face
                  if (stylesheet != null) {
                      faceLoop: for(FontFace fontFace: stylesheet.getFontFaces()) {
                          for(FontFace.FontFaceSrc src: fontFace.getSources()) {
                              if (src.getType() == FontFace.FontFaceSrcType.URL) {
                                  Font loadedFont = Font.loadFont(src.getSrc(),10);
                                  getLogger().info("Loaded @font-face font [" + (loadedFont == null ? "null" : loadedFont.getName()) + "]");
                                  continue faceLoop;
                              }
                          }
                      }

      This needs to be fixed to resolve urls relative to the stylesheet.
                  }

            dgrieve David Grieve
            jasper Jasper Potts (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: