Example usage for java.awt Point.Float setLocation

List of usage examples for java.awt Point.Float setLocation

Introduction

In this page you can find the example usage for java.awt Point.Float setLocation.

Prototype

public void setLocation(double x, double y) 

Source Link

Document

Sets the location of this point to the specified double coordinates.

Usage

From source file:org.apache.fontbox.cff.Type1CharString.java

/**
 * Flex (via OtherSubrs)/*from   ww  w  .  j  a va 2s.c  o m*/
 * @param num OtherSubrs entry number
 */
private void callothersubr(int num) {
    if (num == 0) {
        // end flex
        isFlex = false;

        if (flexPoints.size() < 7) {
            LOG.warn("flex without moveTo in font " + fontName + ", glyph " + glyphName + ", command "
                    + commandCount);
            return;
        }

        // reference point is relative to start point
        Point.Float reference = flexPoints.get(0);
        reference.setLocation(current.getX() + reference.getX(), current.getY() + reference.getY());

        // first point is relative to reference point
        Point.Float first = flexPoints.get(1);
        first.setLocation(reference.getX() + first.getX(), reference.getY() + first.getY());

        // make the first point relative to the start point
        first.setLocation(first.getX() - current.getX(), first.getY() - current.getY());

        rrcurveTo(flexPoints.get(1).getX(), flexPoints.get(1).getY(), flexPoints.get(2).getX(),
                flexPoints.get(2).getY(), flexPoints.get(3).getX(), flexPoints.get(3).getY());

        rrcurveTo(flexPoints.get(4).getX(), flexPoints.get(4).getY(), flexPoints.get(5).getX(),
                flexPoints.get(5).getY(), flexPoints.get(6).getX(), flexPoints.get(6).getY());

        flexPoints.clear();
    } else if (num == 1) {
        // begin flex
        isFlex = true;
    } else {
        // indicates a PDFBox bug
        throw new IllegalArgumentException("Unexpected other subroutine: " + num);
    }
}