com.sap.ip.me.api.pios.printer
Class FontConfigurationManager

java.lang.Object
  extended bycom.sap.ip.me.api.pios.configuration.ConfigurationManager
      extended bycom.sap.ip.me.api.pios.printer.FontConfigurationManager

public class FontConfigurationManager
extends ConfigurationManager

The FontConfigurationManager is used to manage fonts. A font configuration represents a logical font that maps to physical printer font. Since most mobile printers provide a set of pre-installed fonts, the default font configuration contains entries that match the printer’s manufacturer fonts. To map additional fonts, the font must be installed or loaded to the printer’s memory. All changes to the font configuration are handled through this class. The printer connection must be reopen for any changes to take effect.

Example: Add a new font configuration
 
 
	Connector connector = Connector.getInstance();		 
	DriverInfo[] printers = connector.listDrivers(ConnectionType.PRINTER);
	PrinterParameters parameters = new PrinterParameters(printers[0]);
	parameters.setPrinterMode(PrinterParameters.GRAPHIC_MODE);
	GraphicPrinter printer = (GraphicPrinter)connector.open(parameters);

	FontConfigurationManager manager = printer.getFontConfigurationManager();
	Configuration fontConfiguration = manager.addFontConfiguration("NewFont");

	String[] fontParameters = fontConfiguration.getParameters();
	for (int i=0; i<fontParameters.length; i++) {
		fontConfiguration.setParameterValue(fontParameters[i], "NEW VALUE");
	}		

	manager.save();
	printer.close();
	
   
 
 

Since:
MI 2.5
Author:
Abaco
See Also:
com.sap.ip.me.api.pios.configuration

Constructor Summary
protected FontConfigurationManager(ConfigurationManager confManager)
          Creates a new FontConfigurationManager using the specified configuration manager.
 
Method Summary
 Configuration addFontConfiguration(java.lang.String fontName)
          Adds a new empty font configuration to this printer connection.
 void deleteFontConfiguration(java.lang.String fontName)
          Deletes a font configuration for this printer connection.
 Configuration getFontConfiguration(java.lang.String fontName)
          Returns the font Configuration object for the specified font configuration name.
 java.lang.String[] listFontNames()
          Returns available font names for this printer connection.
 void save()
          Stores all font configuration changes.
 
Methods inherited from class com.sap.ip.me.api.pios.configuration.ConfigurationManager
add, delete, get, getConfig, getHeaderName, getParamaterValue, getParameters, getPossibleValues, getTypes, list, list, setParameterValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontConfigurationManager

protected FontConfigurationManager(ConfigurationManager confManager)
                            throws ConfigurationException
Creates a new FontConfigurationManager using the specified configuration manager.

Parameters:
confManager - the configuration manager
Throws:
ConfigurationException - thrown if there is an error while loading the configuration or metadata files
Method Detail

addFontConfiguration

public Configuration addFontConfiguration(java.lang.String fontName)
                                   throws ConfigurationException
Adds a new empty font configuration to this printer connection.

Parameters:
fontName - the font configuration name
Returns:
A new font Configuration object.
Throws:
ConfigurationException - thrown if unable to create new font configuration.

deleteFontConfiguration

public void deleteFontConfiguration(java.lang.String fontName)
                             throws ConfigurationException
Deletes a font configuration for this printer connection.

Parameters:
fontName - the font configuration name
Throws:
ConfigurationException - thrown if unable to delete the font configuration

listFontNames

public java.lang.String[] listFontNames()
                                 throws ConfigurationException
Returns available font names for this printer connection. If there are no fonts configured an empty array is returned.

Returns:
A string array with the name of all configured fonts.
Throws:
ConfigurationException - thrown if an error occurs while obtaining the font list

getFontConfiguration

public Configuration getFontConfiguration(java.lang.String fontName)
                                   throws ConfigurationException
Returns the font Configuration object for the specified font configuration name.

Parameters:
fontName - the font configuration name
Returns:
The font Configuration object.
Throws:
ConfigurationException - thrown if unable to get the font configuration for this connection

save

public void save()
          throws ConfigurationException
Stores all font configuration changes. Changes will be reflected after closing and opening the connection.

Overrides:
save in class ConfigurationManager
Throws:
ConfigurationException - thrown if an error occurs while saving the font configuration file


Copyright © 2005 SAP AG. All Rights Reserved.