Java Doc for GlyphMetrics.java in  » 6.0-JDK-Core » AWT » java » awt » font » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt.font 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.font.GlyphMetrics

GlyphMetrics
final public class GlyphMetrics (Code)
The GlyphMetrics class represents infomation for a single glyph. A glyph is the visual representation of one or more characters. Many different glyphs can be used to represent a single character or combination of characters. GlyphMetrics instances are produced by java.awt.Font Font and are applicable to a specific glyph in a particular Font.

Glyphs are either STANDARD, LIGATURE, COMBINING, or COMPONENT.

  • STANDARD glyphs are commonly used to represent single characters.
  • LIGATURE glyphs are used to represent sequences of characters.
  • COMPONENT glyphs in a GlyphVector do not correspond to a particular character in a text model. Instead, COMPONENT glyphs are added for typographical reasons, such as Arabic justification.
  • COMBINING glyphs embellish STANDARD or LIGATURE glyphs, such as accent marks. Carets do not appear before COMBINING glyphs.

Other metrics available through GlyphMetrics are the components of the advance, the visual bounds, and the left and right side bearings.

Glyphs for a rotated font, or obtained from a GlyphVector which has applied a rotation to the glyph, can have advances that contain both X and Y components. Usually the advance only has one component.

The advance of a glyph is the distance from the glyph's origin to the origin of the next glyph along the baseline, which is either vertical or horizontal. Note that, in a GlyphVector, the distance from a glyph to its following glyph might not be the glyph's advance, because of kerning or other positioning adjustments.

The bounds is the smallest rectangle that completely contains the outline of the glyph. The bounds rectangle is relative to the glyph's origin. The left-side bearing is the distance from the glyph origin to the left of its bounds rectangle. If the left-side bearing is negative, part of the glyph is drawn to the left of its origin. The right-side bearing is the distance from the right side of the bounds rectangle to the next glyph origin (the origin plus the advance). If negative, part of the glyph is drawn to the right of the next glyph's origin. Note that the bounds does not necessarily enclose all the pixels affected when rendering the glyph, because of rasterization and pixel adjustment effects.

Although instances of GlyphMetrics can be directly constructed, they are almost always obtained from a GlyphVector. Once constructed, GlyphMetrics objects are immutable.

Example:

Querying a Font for glyph information

 Font font = ...;
 int glyphIndex = ...;
 GlyphMetrics metrics = GlyphVector.getGlyphMetrics(glyphIndex);
 int isStandard = metrics.isStandard();
 float glyphAdvance = metrics.getAdvance();
 

See Also:   java.awt.Font
See Also:   GlyphVector


Field Summary
final public static  byteCOMBINING
     Indicates a glyph that represents a combining character, such as an umlaut.
final public static  byteCOMPONENT
     Indicates a glyph with no corresponding character in the backing store.
final public static  byteLIGATURE
     Indicates a glyph that represents multiple characters as a ligature, for example 'fi' or 'ffi'.
final public static  byteSTANDARD
     Indicates a glyph that represents a single standard character.
final public static  byteWHITESPACE
     Indicates a glyph with no visual representation.

Constructor Summary
public  GlyphMetrics(float advance, Rectangle2D bounds, byte glyphType)
     Constructs a GlyphMetrics object.
public  GlyphMetrics(boolean horizontal, float advanceX, float advanceY, Rectangle2D bounds, byte glyphType)
     Constructs a GlyphMetrics object.

Method Summary
public  floatgetAdvance()
     Returns the advance of the glyph along the baseline (either horizontal or vertical).
public  floatgetAdvanceX()
     Returns the x-component of the advance of the glyph.
public  floatgetAdvanceY()
     Returns the y-component of the advance of the glyph.
public  Rectangle2DgetBounds2D()
     Returns the bounds of the glyph.
public  floatgetLSB()
     Returns the left (top) side bearing of the glyph.

This is the distance from 0, 0 to the left (top) of the glyph bounds.

public  floatgetRSB()
     Returns the right (bottom) side bearing of the glyph.

This is the distance from the right (bottom) of the glyph bounds to the advance.

public  intgetType()
     Returns the raw glyph type code.
public  booleanisCombining()
     Returns true if this is a combining glyph.
public  booleanisComponent()
     Returns true if this is a component glyph.
public  booleanisLigature()
     Returns true if this is a ligature glyph.
public  booleanisStandard()
     Returns true if this is a standard glyph.
public  booleanisWhitespace()
     Returns true if this is a whitespace glyph.

Field Detail
COMBINING
final public static byte COMBINING(Code)
Indicates a glyph that represents a combining character, such as an umlaut. There is no caret position between this glyph and the preceeding glyph.



COMPONENT
final public static byte COMPONENT(Code)
Indicates a glyph with no corresponding character in the backing store. The glyph is associated with the character represented by the logicaly preceeding non-component glyph. This is used for kashida justification or other visual modifications to existing glyphs. There is no caret position between this glyph and the preceeding glyph.



LIGATURE
final public static byte LIGATURE(Code)
Indicates a glyph that represents multiple characters as a ligature, for example 'fi' or 'ffi'. It is followed by filler glyphs for the remaining characters. Filler and combining glyphs can be intermixed to control positioning of accent marks on the logically preceeding ligature.



STANDARD
final public static byte STANDARD(Code)
Indicates a glyph that represents a single standard character.



WHITESPACE
final public static byte WHITESPACE(Code)
Indicates a glyph with no visual representation. It can be added to the other code values to indicate an invisible glyph.




Constructor Detail
GlyphMetrics
public GlyphMetrics(float advance, Rectangle2D bounds, byte glyphType)(Code)
Constructs a GlyphMetrics object.
Parameters:
  advance - the advance width of the glyph
Parameters:
  bounds - the black box bounds of the glyph
Parameters:
  glyphType - the type of the glyph



GlyphMetrics
public GlyphMetrics(boolean horizontal, float advanceX, float advanceY, Rectangle2D bounds, byte glyphType)(Code)
Constructs a GlyphMetrics object.
Parameters:
  horizontal - if true, metrics are for a horizontal baseline, otherwise they are for a vertical baseline
Parameters:
  advanceX - the X-component of the glyph's advance
Parameters:
  advanceY - the Y-component of the glyph's advance
Parameters:
  bounds - the visual bounds of the glyph
Parameters:
  glyphType - the type of the glyph
since:
   1.4




Method Detail
getAdvance
public float getAdvance()(Code)
Returns the advance of the glyph along the baseline (either horizontal or vertical). the advance of the glyph



getAdvanceX
public float getAdvanceX()(Code)
Returns the x-component of the advance of the glyph. the x-component of the advance of the glyph
since:
   1.4



getAdvanceY
public float getAdvanceY()(Code)
Returns the y-component of the advance of the glyph. the y-component of the advance of the glyph
since:
   1.4



getBounds2D
public Rectangle2D getBounds2D()(Code)
Returns the bounds of the glyph. This is the bounding box of the glyph outline. Because of rasterization and pixel alignment effects, it does not necessarily enclose the pixels that are affected when rendering the glyph. a Rectangle2D that is the bounds of the glyph.



getLSB
public float getLSB()(Code)
Returns the left (top) side bearing of the glyph.

This is the distance from 0, 0 to the left (top) of the glyph bounds. If the bounds of the glyph is to the left of (above) the origin, the LSB is negative. the left side bearing of the glyph.




getRSB
public float getRSB()(Code)
Returns the right (bottom) side bearing of the glyph.

This is the distance from the right (bottom) of the glyph bounds to the advance. If the bounds of the glyph is to the right of (below) the advance, the RSB is negative. the right side bearing of the glyph.




getType
public int getType()(Code)
Returns the raw glyph type code. the raw glyph type code.



isCombining
public boolean isCombining()(Code)
Returns true if this is a combining glyph. true if this is a combining glyph;false otherwise.



isComponent
public boolean isComponent()(Code)
Returns true if this is a component glyph. true if this is a component glyph;false otherwise.



isLigature
public boolean isLigature()(Code)
Returns true if this is a ligature glyph. true if this is a ligature glyph;false otherwise.



isStandard
public boolean isStandard()(Code)
Returns true if this is a standard glyph. true if this is a standard glyph;false otherwise.



isWhitespace
public boolean isWhitespace()(Code)
Returns true if this is a whitespace glyph. true if this is a whitespace glyph;false otherwise.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.