Unified Typesetting API M1-20040817

de.inghuimische.uta.typeset
Interface Anchor


public interface Anchor

An anchor is a hint provided by a Box which describes a point where other boxes should be placed. This is needed for combined characters, math typesetting etc. E.g. the letter 'a' would have an anchor to specify where to place the combining diaerisis ̈. Such information may be provided by a font, but not all do. In this case you could implement an anchor which simply is centered above the 'a'.

Anchors are also known as attachment points.

Anchors may also prove useful for the placement of descriptive text around a graphic.

An anchor is owned by exactly one Box and belongs to one AnchorClass. An anchor can be allocated by one box.

Many fonts provide precomposed glyphs which have no anchors. These glyphs do normally not have anchors, just if you're asking yourself how those fonts manage that. FontForge has a fine handbook dealing with fontformats with additional information about anchors.

Author:
Christian Ziesemer

Method Summary
 void allocate(Anchor anAnchor, Box aBox)
          Allocates this anchor with anAnchor which itself is an anchor of aBox.
 void allocate(Box aBox)
          Allocates this anchor with the given box.
 AnchorClass getAnchorClass()
          Returns the class this anchor belongs to.
 Point2D getLocation()
          Returns the location relative to its owning box.
 boolean isAllocated()
          A anchor is either allocated by a box or not.
 

Method Detail

getLocation

public Point2D getLocation()
Returns the location relative to its owning box.

Returns:
The location relative to its owning box.

getAnchorClass

public AnchorClass getAnchorClass()
Returns the class this anchor belongs to.

Returns:
The class this anchor belongs to.

isAllocated

public boolean isAllocated()
A anchor is either allocated by a box or not.

Returns:
true if the anchor as a box assigned to it, false otherwise.

allocate

public void allocate(Box aBox)
Allocates this anchor with the given box. The box will be placed so that this.getLocation().equals(aBox.getOrigin()).

Parameters:
aBox - The box to be placed at this anchor.

allocate

public void allocate(Anchor anAnchor,
                     Box aBox)
Allocates this anchor with anAnchor which itself is an anchor of aBox. aBox will be placed relative to anAnchor. anAnchor will be translated to match the location of this anchor. So this.getLocation.equals(anAnchor.getLocation())

Parameters:
anAnchor - The anchor of the box to use.
aBox - The box to place.

Unified Typesetting API M1-20040817


An inghuimische.de project.
Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details.