Example usage for org.apache.pdfbox.text TextPosition getYScale

List of usage examples for org.apache.pdfbox.text TextPosition getYScale

Introduction

In this page you can find the example usage for org.apache.pdfbox.text TextPosition getYScale.

Prototype

public float getYScale() 

Source Link

Document

This will get the Y scaling factor.

Usage

From source file:com.tekstosense.segmenter.data.Text.java

License:Open Source License

public static Text newFor(TextPosition tp, PDGraphicsState gs, String text) {
    Text t = new Text();
    t.x = tp.getXDirAdj();//from   ww  w .j a  v a  2s . c  o m
    t.baseline = tp.getYDirAdj();
    t.font = tp.getFont();
    t.strokeColor = gs.getStrokingColor();
    t.nonStrokeColor = gs.getNonStrokingColor();
    t.run = tp.getUnicode();
    t.width = tp.getWidth();
    t.height = tp.getHeight();
    t.pointSize = tp.getFontSizeInPt();
    t.fontSize = tp.getYScale();
    t.tempRun = t.run;

    // Bump the width by the word spacing for each space in tp.
    /*      for (int i=0; i<tp.getCharacter().length(); i++) {
              Character c = tp.getCharacter().charAt(i);
              if (c.equals(" ")) {
    t.width -= tp.getWidthOfSpace();
      t.width += tp.getWordSpacing();
              }
          }
    */
    return t;
}