/** @param font */
  @Override
  public void loadFont(Font font) {
    FontFactory fontFactory = getFontFactoryFromPipeline();
    String fullName = font.getName();
    if (!embeddedFontsLoaded && !fontFactory.isPlatformFont(fullName)) {
      loadEmbeddedFonts();
    }

    // find the native Prism Font object based on this JavaFX font. At the
    // conclusion of this method, be sure to set the name, family, and
    // style on the Font object via the setNativeFont method.

    // the Prism font we're trying to find
    PGFont prismFont = fontFactory.createFont(fullName, (float) font.getSize());

    // update the name variable to match what was actually loaded
    String name = prismFont.getName();
    String family = prismFont.getFamilyName();
    String style = prismFont.getStyleName();
    font.impl_setNativeFont(prismFont, name, family, style);
  }
  /**
   * Searches for an appropriate font based on the font family name and weight and posture style.
   * This method is not guaranteed to return a specific font, but does its best to find one that
   * fits the specified requirements.
   *
   * <p>For SDK/runtime fonts, we will attempt to match properties to a SDK/runtime fonts. If a
   * specific SDK font is not found in the runtime JAR, the font loading will revert to FontFactory
   * default font, rather then finding closest matching available SDK font. This is how SDK font
   * loading was handled in the past.
   *
   * @param family The family of the font
   * @param weight The weight of the font
   * @param posture The posture or posture of the font
   * @param size The point size of the font. This can be a fractional value
   * @profile desktop
   */
  @Override
  public Font font(String family, FontWeight weight, FontPosture posture, float size) {

    FontFactory fontFactory = getFontFactoryFromPipeline();
    if (!embeddedFontsLoaded && !fontFactory.isPlatformFont(family)) {
      loadEmbeddedFonts();
    }

    // REMIND. Some day need to have better granularity.

    boolean bold = weight != null && weight.ordinal() >= FontWeight.BOLD.ordinal();
    boolean italic = posture == FontPosture.ITALIC;
    PGFont prismFont = fontFactory.createFont(family, bold, italic, size);

    // Create Font and set implementation
    Font fxFont =
        Font.impl_NativeFont(
            prismFont,
            prismFont.getName(),
            prismFont.getFamilyName(),
            prismFont.getStyleName(),
            size);
    return fxFont;
  }
 @SuppressWarnings("deprecation")
 private Font createFont(PGFont font) {
   return Font.impl_NativeFont(
       font, font.getName(), font.getFamilyName(), font.getStyleName(), font.getSize());
 }