home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / font / GlyphJustificationInfo.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  5.7 KB  |  159 lines

  1. /*
  2.  * @(#)GlyphJustificationInfo.java    1.11 98/03/18
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /*
  16.  * (C) Copyright Taligent, Inc. 1996 - 1997, All Rights Reserved
  17.  * (C) Copyright IBM Corp. 1996 - 1998, All Rights Reserved
  18.  *
  19.  * The original version of this source code and documentation is
  20.  * copyrighted and owned by Taligent, Inc., a wholly-owned subsidiary
  21.  * of IBM. These materials are provided under terms of a License
  22.  * Agreement between Taligent and Sun. This technology is protected
  23.  * by multiple US and International patents.
  24.  *
  25.  * This notice and attribution to Taligent may not be removed.
  26.  * Taligent is a registered trademark of Taligent, Inc.
  27.  *
  28.  */
  29.  
  30. package java.awt.font;
  31.  
  32. /**
  33.  * GlyphJustificationInfo represents information about the justification
  34.  * properties of a glyph.
  35.  * <p>
  36.  * Weight is the overall 'weight' of the glyph in the line.  Generally it is
  37.  * proportional to the size of the font.  Glyphs with larger weight are
  38.  * allocated a correspondingly larger amount of the change in space.
  39.  * <p>
  40.  * Priority determines the justification phase in which this glyph is used.
  41.  * All glyphs of the same priority are examined before glyphs of the next
  42.  * lower priority.  If all the change in space can be allocated to these
  43.  * glyphs without exceeding their limits, then lower priority glyphs are not
  44.  * examined.
  45.  * <p>
  46.  * Absorb determines whether a glyph absorbs all change in space.  Within a
  47.  * given priority, some glyphs may absorb all the change in space.  If any of
  48.  * these glyphs are present, no glyphs of lower priority will be examined.
  49.  * <p>
  50.  * Limit determines the maximum or minimum amount by which the glyph can
  51.  * change. Left and right sides of the glyph may have different limits.
  52.  * <p>
  53.  * Each justification info represents two sets of metrics, growing and
  54.  * shrinking.  Growing metrics are used when the glyphs on a line are to be
  55.  * spread apart to fit a larger width, shrinking metrics are used when the
  56.  * glyphs are to be moved together to fit a smaller width.
  57.  * <p>
  58.  * <strong>Example:</strong>
  59.  * Querying a Font for justification information
  60.  * <blockquote><pre>
  61.  * Font font = ...;
  62.  * int glyphCode = ...;
  63.  * GlyphJustificationInfo info = font.getGlyphJustificationInfo(glyphCode);
  64.  * </blockquote></pre>
  65.  */
  66.  
  67. public final class GlyphJustificationInfo {
  68.  
  69.     /**
  70.      * Construct information about the justification properties of a glyph.
  71.      *
  72.      * @param weight the weight of this glyph
  73.      * @param growAbsorb if true, when growing this glyph absorbs all extra
  74.      * space at this and lower priority levels
  75.      * @param growPriority the priority level of this glyph when growing
  76.      * @param growLeftLimit the maximum amount by which the left side of this
  77.      * glyph can grow
  78.      * @param growRightLimit the maximum amount by which the right side of this
  79.      * glyph can grow
  80.      * @param shrinkAbsorb if true, when shrinking this glyph absorbs all
  81.      * remaining shrinkage at this and lower priority levels
  82.      * @param shrinkPriority the priority level of this glyph when shrinking
  83.      * @param shrinkLeftLimit the maximum amount by which the left side of this
  84.      * glyph can shrink (a positive number)
  85.      * @param shrinkRightLimit the maximum amoun by which the right side of
  86.      * this glyph can shrink (a postive number)
  87.      * @see Font2#getGlyphJustificationInfo
  88.      */
  89.     public GlyphJustificationInfo(float weight,
  90.                                   boolean growAbsorb, 
  91.                   int growPriority,
  92.                                   float growLeftLimit,
  93.                                   float growRightLimit,
  94.                                   boolean shrinkAbsorb, 
  95.                   int shrinkPriority,
  96.                                   float shrinkLeftLimit, 
  97.                   float shrinkRightLimit)
  98.     {
  99.         this.weight = weight;
  100.         this.growAbsorb = growAbsorb;
  101.         this.growPriority = (byte)growPriority;
  102.         this.growLeftLimit = growLeftLimit;
  103.         this.growRightLimit = growRightLimit;
  104.         this.shrinkAbsorb = shrinkAbsorb;
  105.         this.shrinkPriority = (byte)shrinkPriority;
  106.         this.shrinkLeftLimit = shrinkLeftLimit;
  107.         this.shrinkRightLimit = shrinkRightLimit;
  108.     }
  109.  
  110.     /**
  111.      * The weight of this glyph.
  112.      */
  113.     public final float weight;
  114.     
  115.     /**
  116.      * The priority level of this glyph when growing.
  117.      */
  118.     public final byte growPriority;
  119.     
  120.     /**
  121.      * If true, when growing this glyph absorbs all extra space at this and
  122.      * lower priority levels.
  123.      */
  124.     public final boolean growAbsorb;
  125.     
  126.     /**
  127.      * The maximum amount by which the left side of this glyph can grow.
  128.      */
  129.     public final float growLeftLimit;
  130.     
  131.     /**
  132.      * The maximum amount by which the right side of this glyph can grow.
  133.      */
  134.     public final float growRightLimit;
  135.     
  136.     /**
  137.      * The priority level of this glyph when shrinking.
  138.      */
  139.     public final byte shrinkPriority;
  140.     
  141.     /**
  142.      * If true, when shrinking this glyph absorbs all remaining shrinkage at
  143.      * this and lower priority levels.
  144.      */
  145.     public final boolean shrinkAbsorb;
  146.     
  147.     /**
  148.      * The maximum amount by which the left side of this glyph can shrink
  149.      * (a positive number).
  150.      */
  151.     public final float shrinkLeftLimit;
  152.     
  153.     /**
  154.      * The maximum amount by which the right side of this glyph can shrink
  155.      * (a positive number).
  156.      */
  157.     public final float shrinkRightLimit;
  158. }
  159.