/**
   * 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());
 }