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

java.lang.Object
  extended bycom.sap.ip.me.api.pios.printer.Metrics

public final class Metrics
extends java.lang.Object

This class represents a measurement (height, width) specified in points (1/72th of an inch units) for a field. This information then can be used to calculate the position of a field in a page. A field can be text, barcode or image.

Example: Centering text.
 
 	
	String TITLE = "This is My Title";
	PrinterFont font = graphicPrinter.getFont("Scalable");
	Metrics metrics = font.getMetrics(TITLE); 
	float center = (pageWidth/2) - (metrics.getWidth()/2);
		
	graphicPrinter.drawText(font, center, 0, TITLE, GraphicPrinter.NO_ROTATION);
 		
 
 

Since:
MI 2.5
Author:
Abaco
See Also:
PrinterBarcode, PrinterImage, PrinterFont

Constructor Summary
protected Metrics(float width, float height)
          Creates a new Metrics object.
 
Method Summary
 float getHeight()
          Returns the height of a field in points.
 float getWidth()
          Returns the width of a field in points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Metrics

protected Metrics(float width,
                  float height)
Creates a new Metrics object.

Parameters:
width - the field width in points (1/72nds of an inch units)
height - the field height in points (1/72nds of an inch units)
Method Detail

getHeight

public float getHeight()
Returns the height of a field in points.

Returns:
The field height in points (1/72nds of an inch units).

getWidth

public float getWidth()
Returns the width of a field in points.

Returns:
The field width in points (1/72nds of an inch units).


Copyright © 2005 SAP AG. All Rights Reserved.