Class GlyphBBoxOutlineConsumer

  • All Implemented Interfaces:
    OutlineConsumer

    public final class GlyphBBoxOutlineConsumer
    extends java.lang.Object
    implements OutlineConsumer
    A bezier consumer used to calculate the glyph bbox. This consumer can be used to calculate multiple bboxes, but the reset method must be called between each calculation.

    Synchronization

    This class is not synchronized. Multiple instances can safely coexist without threadsafety issues, but each must only be accessed from one thread (or must be guarded by the client).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void curveto​(double x1, double y1, double x2, double y2)
      Called for a quadratic curve.
      void curveto​(double x1, double y1, double x2, double y2, double x3, double y3)
      Called for a cubic curve.
      void endchar()
      Called to signal the end of a glyph's outline.
      Rect getBBox()
      Returns the glyph bbox.
      void lineto​(double x, double y)
      Called for a line.
      void moveto​(double x, double y)
      Called to set a new currentpoint.
      void reset()
      resets the state of the consumer so that a new bbox can be calculated
      void setMatrix​(Matrix newMatrix)
      Tells the OutlineConsumer the matrix to be applied to subsequent points in order to get to a 1 ppem size.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GlyphBBoxOutlineConsumer

        public GlyphBBoxOutlineConsumer​(Matrix finalMatrix)
    • Method Detail

      • reset

        public void reset()
        resets the state of the consumer so that a new bbox can be calculated
      • setMatrix

        public void setMatrix​(Matrix newMatrix)
        Description copied from interface: OutlineConsumer
        Tells the OutlineConsumer the matrix to be applied to subsequent points in order to get to a 1 ppem size. It is possible for setMatrix to be called multiple times for a single glyph. Each call replaces the previous matrix. It is guaranteed that setMatrix will be called prior to any other methods.
        Specified by:
        setMatrix in interface OutlineConsumer
      • moveto

        public void moveto​(double x,
                           double y)
        Description copied from interface: OutlineConsumer
        Called to set a new currentpoint. If lineto or curveto was previously been called and was the most recent function called, an implied lineto should precede this move and should close the previous segment by connecting the last point in the most recent line/curve with the point that started the last segment.
        Specified by:
        moveto in interface OutlineConsumer
        Parameters:
        x - the x coordinate of the new currentpoint
        y - the y coordinate of the new currentpoint
      • lineto

        public void lineto​(double x,
                           double y)
        Description copied from interface: OutlineConsumer
        Called for a line. The line goes from the current point to (x, y). After this call, the currentpoint should be x,y
        Specified by:
        lineto in interface OutlineConsumer
      • curveto

        public void curveto​(double x1,
                            double y1,
                            double x2,
                            double y2)
        Description copied from interface: OutlineConsumer
        Called for a quadratic curve. The control points are the current point, (x2, y2), (x3, y3). After this call, the currentpoint should be x3, y3.
        Specified by:
        curveto in interface OutlineConsumer
      • curveto

        public void curveto​(double x1,
                            double y1,
                            double x2,
                            double y2,
                            double x3,
                            double y3)
        Description copied from interface: OutlineConsumer
        Called for a cubic curve. The control points are the current point, (x2, y2), (x3, y3), (x4, y4). After this call, the currentpoint should be x4, y4.
        Specified by:
        curveto in interface OutlineConsumer
      • getBBox

        public Rect getBBox()
        Returns the glyph bbox. This function can be called any time after the outlines have been run through this consumer.
      • endchar

        public void endchar()
        Description copied from interface: OutlineConsumer
        Called to signal the end of a glyph's outline. The last path will already be closed by the time this is called.
        Specified by:
        endchar in interface OutlineConsumer