All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.dreampie.captcha.text.render.TextCharacter Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2009 Piotr Piastucki
 * 
 * This file is part of Patchca captcha.patchca library.
 * 
 *  Patchca is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  Patchca is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *  
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Patchca. If not, see .
 */
package cn.dreampie.captcha.text.render;

import java.awt.*;
import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;

public class TextCharacter {

  private double x;
  private double y;
  private double width;
  private double height;
  private double ascent;
  private double descent;
  private char character;
  private Font font;
  private Color color;

  public double getX() {
    return x;
  }

  public void setX(double x) {
    this.x = x;
  }

  public double getY() {
    return y;
  }

  public void setY(double y) {
    this.y = y;
  }

  public double getWidth() {
    return width;
  }

  public void setWidth(double width) {
    this.width = width;
  }

  public double getHeight() {
    return height;
  }

  public void setHeight(double height) {
    this.height = height;
  }

  public char getCharacter() {
    return character;
  }

  public void setCharacter(char character) {
    this.character = character;
  }

  public Font getFont() {
    return font;
  }

  public void setFont(Font font) {
    this.font = font;
  }

  public Color getColor() {
    return color;
  }

  public void setColor(Color color) {
    this.color = color;
  }

  public double getAscent() {
    return ascent;
  }

  public void setAscent(double ascent) {
    this.ascent = ascent;
  }

  public double getDescent() {
    return descent;
  }

  public void setDescent(double descent) {
    this.descent = descent;
  }

  public AttributedCharacterIterator iterator() {
    AttributedString aString = new AttributedString(String
        .valueOf(character));
    aString.addAttribute(TextAttribute.FONT, font, 0, 1);
    return aString.getIterator();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy