/* * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.javafx.font; import java.io.InputStream; public interface FontFactory { public static final String DEFAULT_FULLNAME = "System Regular"; public PGFont createFont(String name, float size); public PGFont createFont(String family, boolean bold, boolean italic, float size); /** * Creates a new Font object by replicating the current Font object * and applying a new bold style, italic style, and size to it. *
* NOTE: bold and italic are hints.
*
* @param font the original font.
* @param bold the bold style for the new font.
* @param italic the italic style fort the new font.
* @param size the size for the new font.
* @return the new font.
*/
public PGFont deriveFont(PGFont font,
boolean bold, boolean italic, float size);
public String[] getFontFamilyNames();
public String[] getFontFullNames();
public String[] getFontFullNames(String family);
/*
* Indicates permission to load an embedded font
*/
public boolean hasPermission();
/**
* Loads a font from the specified input stream.
* If the load is successful such that the stream can be
* fully read, and it represents a supported font format then a
* PGFont
object will be returned.
*
* Any failure such as abbreviated input, or an unsupported font format
* will result in a null
return. It is the application's
* responsibility to check this before use.
*
* If the register
flag is true, and the loading operation
* completes successfully, then the returned font is registered
* with the FX graphics system for creation by available constructors
* and factory methods, and the application should use it in this
* manner rather than calling this method again, which would
* repeat the overhead of re-reading and installing the font.
*
* When the font is registered, an alternative name
can be
* supplied. This name can be used for creation by available constructors
* and factory methods.
*
* The font size
parameter is a convenience so that in
* typical usage the application can directly use the returned (non-null)
* font rather than needing to create one via a constructor. Invalid sizes
* are those <=0 and will result in a default size.
*
* This method does not close the input stream.
*
* @param name the name for font, it can be null
.
* @param stream the stream from which to load the font.
* @param size the size for the font.
* @param register whether the font should be register.
* @return the Font, or null if the font cannot be created.
*/
public PGFont loadEmbeddedFont(String name, InputStream stream,
float size, boolean register);
/**
* Loads a font from the specified path. If the load is successful
* such that the location is readable, and it represents a supported
* font format then a PGFont
object will be returned.
*
* Any failure such as a file being unable to locate or read
* from the resource, or if it doesn't represent a font, will result in
* a null
return. It is the application's responsibility
* to check this before use.
*
* If the register
flag is true, and the loading operation
* completes successfully, then the returned font is registered
* with the FX graphics system for creation by available constructors
* and factory methods, and the application should use it in this
* manner rather than calling this method again, which would
* repeat the overhead of re-reading and installing the font.
*
* When the font is registered, an alternative name
can be
* supplied. This name can be used for creation by available constructors
* and factory methods.
*
* The font size
parameter is a convenience so that in
* typical usage the application can directly use the returned (non-null)
* font rather than needing to create one via a constructor. Invalid sizes
* are those <=0 and will result in a default size.
*
* @param name the name for font, it can be null
.
* @param path the path from which to load the font.
* @param size the size for the font.
* @param register whether the font should be register.
* @return the Font, or null if the font cannot be created.
*/
public PGFont loadEmbeddedFont(String name, String path,
float size, boolean register);
public boolean isPlatformFont(String name);
}