2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * (C) Copyright Taligent, Inc. 1996 - 1997, All Rights Reserved 0N/A * (C) Copyright IBM Corp. 1996 - 1998, All Rights Reserved 0N/A * The original version of this source code and documentation is 0N/A * copyrighted and owned by Taligent, Inc., a wholly-owned subsidiary 0N/A * of IBM. These materials are provided under terms of a License 0N/A * Agreement between Taligent and Sun. This technology is protected 0N/A * by multiple US and International patents. 0N/A * This notice and attribution to Taligent may not be removed. 0N/A * Taligent is a registered trademark of Taligent, Inc. 0N/A * The <code>GlyphMetrics</code> class represents infomation for a 0N/A * single glyph. A glyph is the visual representation of one or more 0N/A * characters. Many different glyphs can be used to represent a single 0N/A * character or combination of characters. <code>GlyphMetrics</code> 0N/A * instances are produced by {@link java.awt.Font Font} and are applicable 0N/A * to a specific glyph in a particular <code>Font</code>. 0N/A * Glyphs are either STANDARD, LIGATURE, COMBINING, or COMPONENT. 0N/A * <li>STANDARD glyphs are commonly used to represent single characters. 0N/A * <li>LIGATURE glyphs are used to represent sequences of characters. 0N/A * <li>COMPONENT glyphs in a {@link GlyphVector} do not correspond to a 0N/A * particular character in a text model. Instead, COMPONENT glyphs are 0N/A * added for typographical reasons, such as Arabic justification. 0N/A * <li>COMBINING glyphs embellish STANDARD or LIGATURE glyphs, such 0N/A * as accent marks. Carets do not appear before COMBINING glyphs. 0N/A * Other metrics available through <code>GlyphMetrics</code> are the 0N/A * components of the advance, the visual bounds, and the left and right 0N/A * Glyphs for a rotated font, or obtained from a <code>GlyphVector</code> 0N/A * which has applied a rotation to the glyph, can have advances that 0N/A * contain both X and Y components. Usually the advance only has one 0N/A * The advance of a glyph is the distance from the glyph's origin to the 0N/A * origin of the next glyph along the baseline, which is either vertical 0N/A * or horizontal. Note that, in a <code>GlyphVector</code>, 0N/A * the distance from a glyph to its following glyph might not be the 0N/A * glyph's advance, because of kerning or other positioning adjustments. 0N/A * The bounds is the smallest rectangle that completely contains the 0N/A * outline of the glyph. The bounds rectangle is relative to the 0N/A * glyph's origin. The left-side bearing is the distance from the glyph 0N/A * origin to the left of its bounds rectangle. If the left-side bearing is 0N/A * negative, part of the glyph is drawn to the left of its origin. The 0N/A * right-side bearing is the distance from the right side of the bounds 0N/A * rectangle to the next glyph origin (the origin plus the advance). If 0N/A * negative, part of the glyph is drawn to the right of the next glyph's 0N/A * origin. Note that the bounds does not necessarily enclose all the pixels 0N/A * affected when rendering the glyph, because of rasterization and pixel 0N/A * adjustment effects. 0N/A * Although instances of <code>GlyphMetrics</code> can be directly 0N/A * constructed, they are almost always obtained from a 0N/A * <code>GlyphVector</code>. Once constructed, <code>GlyphMetrics</code> 0N/A * objects are immutable. 0N/A * <strong>Example</strong>:<p> 0N/A * Querying a <code>Font</code> for glyph information 0N/A * int glyphIndex = ...; 0N/A * GlyphMetrics metrics = GlyphVector.getGlyphMetrics(glyphIndex); 0N/A * int isStandard = metrics.isStandard(); 0N/A * float glyphAdvance = metrics.getAdvance(); 0N/A * </pre></blockquote> 0N/A * @see java.awt.Font 0N/A * Indicates whether the metrics are for a horizontal or vertical baseline. 0N/A * The x-component of the advance. 0N/A * The y-component of the advance. 0N/A * The bounds of the associated glyph. 0N/A * Additional information about the glyph encoded as a byte. 0N/A * Indicates a glyph that represents a single standard 0N/A * Indicates a glyph that represents multiple characters 0N/A * as a ligature, for example 'fi' or 'ffi'. It is followed by 0N/A * filler glyphs for the remaining characters. Filler and combining 0N/A * glyphs can be intermixed to control positioning of accent marks 0N/A * on the logically preceeding ligature. 0N/A * Indicates a glyph that represents a combining character, 0N/A * such as an umlaut. There is no caret position between this glyph 0N/A * and the preceeding glyph. 0N/A * Indicates a glyph with no corresponding character in the 0N/A * backing store. The glyph is associated with the character 0N/A * represented by the logicaly preceeding non-component glyph. This 0N/A * is used for kashida justification or other visual modifications to 0N/A * existing glyphs. There is no caret position between this glyph 0N/A * and the preceeding glyph. 0N/A * Indicates a glyph with no visual representation. It can 0N/A * be added to the other code values to indicate an invisible glyph. 0N/A * Constructs a <code>GlyphMetrics</code> object. 0N/A * @param advance the advance width of the glyph 0N/A * @param bounds the black box bounds of the glyph 0N/A * @param glyphType the type of the glyph 0N/A * Constructs a <code>GlyphMetrics</code> object. 0N/A * @param horizontal if true, metrics are for a horizontal baseline, 0N/A * otherwise they are for a vertical baseline 0N/A * @param advanceX the X-component of the glyph's advance 0N/A * @param advanceY the Y-component of the glyph's advance 0N/A * @param bounds the visual bounds of the glyph 0N/A * @param glyphType the type of the glyph 0N/A * Returns the advance of the glyph along the baseline (either 0N/A * horizontal or vertical). 0N/A * @return the advance of the glyph 0N/A * Returns the x-component of the advance of the glyph. 0N/A * @return the x-component of the advance of the glyph 0N/A * Returns the y-component of the advance of the glyph. 0N/A * @return the y-component of the advance of the glyph 0N/A * Returns the bounds of the glyph. This is the bounding box of the glyph outline. 0N/A * Because of rasterization and pixel alignment effects, it does not necessarily 0N/A * enclose the pixels that are affected when rendering the glyph. 0N/A * @return a {@link Rectangle2D} that is the bounds of the glyph. 0N/A * Returns the left (top) side bearing of the glyph. 0N/A * This is the distance from 0, 0 to the left (top) of the glyph 0N/A * bounds. If the bounds of the glyph is to the left of (above) the 0N/A * origin, the LSB is negative. 0N/A * @return the left side bearing of the glyph. 0N/A * Returns the right (bottom) side bearing of the glyph. 0N/A * This is the distance from the right (bottom) of the glyph bounds to 0N/A * the advance. If the bounds of the glyph is to the right of (below) 0N/A * the advance, the RSB is negative. 0N/A * @return the right side bearing of the glyph. 0N/A * Returns the raw glyph type code. 0N/A * @return the raw glyph type code. 0N/A * Returns <code>true</code> if this is a standard glyph. 0N/A * @return <code>true</code> if this is a standard glyph; 0N/A * <code>false</code> otherwise. 0N/A * Returns <code>true</code> if this is a ligature glyph. 0N/A * @return <code>true</code> if this is a ligature glyph; 0N/A * <code>false</code> otherwise. 0N/A * Returns <code>true</code> if this is a combining glyph. 0N/A * @return <code>true</code> if this is a combining glyph; 0N/A * <code>false</code> otherwise. 0N/A * Returns <code>true</code> if this is a component glyph. 0N/A * @return <code>true</code> if this is a component glyph; 0N/A * <code>false</code> otherwise. 0N/A * Returns <code>true</code> if this is a whitespace glyph. 0N/A * @return <code>true</code> if this is a whitespace glyph; 0N/A * <code>false</code> otherwise.