home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 6.2 KB | 237 lines |
- /*
- * @(#)GlyphSetComponent.java 1.4 98/03/18
- *
- * Copyright 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
- /*
- * (C) Copyright Taligent, Inc. 1996 - 1997, All Rights Reserved
- * (C) Copyright IBM Corp. 1996 - 1998, All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by Taligent, Inc., a wholly-owned subsidiary
- * of IBM. These materials are provided under terms of a License
- * Agreement between Taligent and Sun. This technology is protected
- * by multiple US and International patents.
- *
- * This notice and attribution to Taligent may not be removed.
- * Taligent is a registered trademark of Taligent, Inc.
- *
- */
-
- package java.awt.font;
-
- import java.text.AttributedCharacterIterator;
- import java.awt.geom.Rectangle2D;
- import java.awt.Graphics2D;
- import java.awt.Font;
-
- class GlyphSetComponent implements TextLayoutComponent {
-
- private final GlyphSet fGlyphSet;
-
- public GlyphSetComponent(GlyphSet glyphSet) {
-
- fGlyphSet = glyphSet;
- }
-
- public float getAdvance() {
-
- return fGlyphSet.getAdvance();
- }
-
- public float getAscent() {
-
- return fGlyphSet.getAscent();
- }
-
- public float getDescent(float ascent) {
-
- return fGlyphSet.getDescent();
- }
-
- public float getLeading() {
-
- return fGlyphSet.getFont().getLeading();
- }
-
- public int getNumGlyphs() {
-
- return fGlyphSet.getNumGlyphs();
- }
-
- public int getNumCharacters() {
-
- return fGlyphSet.getNumCharacters();
- }
-
- public byte getBaseline() {
-
- return fGlyphSet.getBaseline();
- }
-
- public float getXAdjust() {
-
- return fGlyphSet.getXAdjust();
- }
-
- public float getGlyphXAdvance(int index) {
-
- return fGlyphSet.getGlyphXAdvance(index);
- }
-
- public float getYAdjust() {
-
- return fGlyphSet.getYAdjust();
- }
-
- public float getGlyphYAdvance(int index) {
-
- return fGlyphSet.getGlyphYAdvance(index);
- }
-
- public float getGlyphAdvance(int index) {
-
- return fGlyphSet.getGlyphAdvance(index);
- }
-
- public int visualToLogicalIndex(int index) {
-
- return fGlyphSet.visualToLogicalIndex(index);
- }
-
- public byte getLevel(int index) {
-
- return fGlyphSet.getLevel(index);
- }
-
- public boolean isCompletelyLTR() {
-
- return fGlyphSet.isCompletelyLTR();
- }
-
- public TextLayoutComponent applyJustification(
- float[] deltas, int index, boolean[] flags) {
-
- GlyphSet gs = fGlyphSet.applyJustification(deltas, index, flags);
- return new GlyphSetComponent(gs);
- }
-
- public float getAdvanceBetween(int start, int limit) {
-
- return fGlyphSet.getAdvanceBetween(start, limit);
- }
-
- public int getLineBreakIndex(int start, float hitAdvance) {
-
- return fGlyphSet.getLineBreakIndex(start, hitAdvance);
- }
-
- public TextLayoutComponent subset(int start, int limit) {
-
- GlyphSet gs = fGlyphSet.subset(start, limit);
- return new GlyphSetComponent(gs);
- }
-
- public TextLayoutComponent insertChar(
- AttributedCharacterIterator newText,
- int start, int limit,
- int insertPos,
- int[] order,
- byte[] levels) {
-
- GlyphSet gs = fGlyphSet.insertChar(
- newText, start, limit, insertPos, order, levels);
- return new GlyphSetComponent(gs);
- }
-
- public TextLayoutComponent deleteChar(
- AttributedCharacterIterator newText,
- int start, int limit,
- int deletePos,
- int[] order,
- byte[] levels) {
-
- GlyphSet gs = fGlyphSet.deleteChar(
- newText, start, limit, deletePos, order, levels);
- return new GlyphSetComponent(gs);
- }
-
- public TextLayoutComponent reshape(
- AttributedCharacterIterator newText,
- int start, int limit,
- int changePos,
- int[] order,
- byte[] levels) {
-
- GlyphSet gs = fGlyphSet.reshape(
- newText, start, limit, changePos, order, levels);
- return new GlyphSetComponent(gs);
- }
-
- public void draw(Graphics2D graphics, float x, float y, TextLayout hostLayout) {
-
- fGlyphSet.draw(graphics, x, y);
- }
-
- public Rectangle2D getBounds(TextLayout hostLayout) {
-
- return fGlyphSet.getBounds();
- }
-
- public TextLayoutComponent setDirection(boolean leftToRight) {
-
- GlyphSet gs = fGlyphSet.setDirection(leftToRight);
- return new GlyphSetComponent(gs);
- }
-
- public GlyphMetrics getGlyphMetrics(int index, TextLayout hostLayout) {
-
- Font font = fGlyphSet.getFont();
- return font.getGlyphMetrics(fGlyphSet.getGlyphCode(index));
- }
-
- public boolean isComponent(int index) {
-
- Font font = fGlyphSet.getFont();
- return font.getGlyphMetrics(fGlyphSet.getGlyphCode(index)).isComponent();
- }
-
- public int hashCode() {
-
- return fGlyphSet.hashCode();
- }
-
- public boolean equals(TextLayoutComponent rhs) {
-
- try {
- return fGlyphSet.equals(((GlyphSetComponent)rhs).fGlyphSet);
- }
- catch (ClassCastException e) {
- return false;
- }
- }
-
- public float getItalicAngle() {
-
- return fGlyphSet.getFont().getItalicAngle();
- }
-
- public GlyphJustificationInfo getGlyphJustificationInfo(int index) {
-
- Font font = fGlyphSet.getFont();
- int glyphCode = fGlyphSet.getGlyphCode(index);
-
- return font.getGlyphJustificationInfo(glyphCode);
- }
- }
-
-