KnuthGlue (Apache FOP 2.7 API)
Date: 2022-01-12

org.apache.fop.layoutmgr

## Class KnuthGlue

- java.lang.Object
- - org.apache.fop.layoutmgr.ListElement
  - - org.apache.fop.layoutmgr.KnuthElement
    - - org.apache.fop.layoutmgr.KnuthGlue

-     public class KnuthGlue
      extends KnuthElement

  An instance of this class represents a piece of content with adjustable width: for example a space between words of justified text. A KnuthGlue is a feasible breaking point only if it immediately follows a KnuthBox. The represented piece of content is suppressed if either the KnuthGlue is a chosen breaking point or there isn't any KnuthBox between the previous breaking point and the KnuthGlue itself. So, an unsuppressible piece of content with adjustable width, for example a leader or a word with adjustable letter space, cannot be represented by a single KnuthGlue; it can be represented using the sequence: KnuthBox(width = 0) KnuthPenalty(width = 0, penalty = infinity) KnuthGlue(...) KnuthBox(width = 0) where the infinity penalty avoids choosing the KnuthGlue as a breaking point and the 0-width KnuthBoxes prevent suppression. Besides the inherited methods and attributes, this class has two attributes used to store the stretchability (difference between max and opt width) and the shrinkability (difference between opt and min width), and the methods to get these values.

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.layoutmgr.KnuthElement

      `INFINITE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KnuthGlue(int width, int stretch, int shrink, Adjustment adjustmentClass, Position pos, boolean auxiliary)` Creates a new `KnuthGlue`.
    `KnuthGlue(int width, int stretch, int shrink, Position pos, boolean auxiliary)` Creates a new `KnuthGlue`.
    `KnuthGlue(MinOptMax minOptMax, Position pos, boolean auxiliary)` Creates a new `KnuthGlue`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Adjustment` | `getAdjustmentClass()`
    `int` | `getShrink()`
    `int` | `getStretch()`
    `boolean` | `isGlue()`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.apache.fop.layoutmgr.KnuthElement

      `getPenalty, getWidth, isAuxiliary, isUnresolvedElement`

    - ### Methods inherited from class org.apache.fop.layoutmgr.ListElement

      `getLayoutManager, getPosition, isBox, isForcedBreak, isPenalty, setPosition`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### KnuthGlue

          public KnuthGlue(MinOptMax minOptMax,
                           Position pos,
                           boolean auxiliary)

      Creates a new `KnuthGlue`.
      Parameters:
        `minOptMax` - a `MinOptMax` where the `opt-value` is mapped to the width, the `stretchability` is mapped to the stretchability and the the `shrinkability` is mapped to the shrinkability
        `pos` - the Position stored in this glue
        `auxiliary` - is this glue auxiliary?

    - #### KnuthGlue

          public KnuthGlue(int width,
                           int stretch,
                           int shrink,
                           Position pos,
                           boolean auxiliary)

      Creates a new `KnuthGlue`.
      Parameters:
        `width` - the width of this glue
        `stretch` - the stretchability of this glue
        `shrink` - the shrinkability of this glue
        `pos` - the Position stored in this glue
        `auxiliary` - is this glue auxiliary?

    - #### KnuthGlue

          public KnuthGlue(int width,
                           int stretch,
                           int shrink,
                           Adjustment adjustmentClass,
                           Position pos,
                           boolean auxiliary)

      Creates a new `KnuthGlue`.
      Parameters:
        `width` - the width of this glue
        `stretch` - the stretchability of this glue
        `shrink` - the shrinkability of this glue
        `adjustmentClass` - the adjsutment class
        `pos` - the Position stored in this glue
        `auxiliary` - is this glue auxiliary?

  - ### Method Detail

    - #### isGlue

          public boolean isGlue()

      Overrides:
        `isGlue` in class `ListElement`
      Returns:
        true if this element is a KnuthGlue.

    - #### getStretch

          public int getStretch()

      Overrides:
        `getStretch` in class `KnuthElement`
      Returns:
        the stretchability of this glue.

    - #### getShrink

          public int getShrink()

      Overrides:
        `getShrink` in class `KnuthElement`
      Returns:
        the shrinkability of this glue.

    - #### getAdjustmentClass

          public Adjustment getAdjustmentClass()

      Returns:
        the adjustment class (or role) of this glue.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright 1999-2022 The Apache Software Foundation. All Rights Reserved.