rita
Class RiPageLayout

java.lang.Object
  extended by rita.RiObject
      extended by rita.RiPageLayout
All Implemented Interfaces:
processing.core.PConstants, RiConstants

public class RiPageLayout
extends RiObject

Note: still under-development, use w' care...

Invisible:

Field Summary
static boolean DEFAULT_INDENT_FIRST_PARAGRAPH
          whether to add an indent to first paragraph for a page layout (default true)
static float DEFAULT_LEADING
          amount of lead to use between lines (default is twice the font-height)
static int DEFAULT_PARAGRAPH_INDENT
          # of (space-width) characters to use as a paragraph indent (default=0)
static float DEFAULT_PARAGRAPH_SPACING
          amount of additional lead to add between paragraphs (default is 0)
 
Fields inherited from interface rita.support.RiConstants
BEHAVIOR_COMPLETED, BOUNDING_BOX_ALPHA, BRILL_POS_TAGGER, EASE_IN, EASE_IN_CUBIC, EASE_IN_EXPO, EASE_IN_OUT, EASE_IN_OUT_CUBIC, EASE_IN_OUT_EXPO, EASE_IN_OUT_QUARTIC, EASE_IN_OUT_SINE, EASE_IN_QUARTIC, EASE_IN_SINE, EASE_OUT, EASE_OUT_CUBIC, EASE_OUT_EXPO, EASE_OUT_QUARTIC, EASE_OUT_SINE, ESS, FADE_COLOR, FADE_IN, FADE_OUT, FADE_TO_TEXT, FIRST_PERSON, FUTURE_TENSE, ID, LERP, LINEAR, MAXENT_POS_TAGGER, MINIM, MOVE, MUTABLE, PAST_TENSE, PHONEME_BOUNDARY, PHONEMES, PLING_STEMMER, PLURAL, PORTER_STEMMER, POS, PRESENT_TENSE, SCALE_TO, SECOND_PERSON, SENTENCE_BOUNDARY, SINGULAR, SONIA, SPEECH_COMPLETED, STRESSES, SYLLABLE_BOUNDARY, SYLLABLES, TEXT, TEXT_ENTERED, THIRD_PERSON, TIMER, TIMER_COMPLETED, TIMER_TICK, TOKENS, UNKNOWN, WORD_BOUNDARY
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
RiPageLayout(processing.core.PApplet pApplet, int leftMargin, int topMargin, int rightMargin, int bottomMargin)
           
RiPageLayout(processing.core.PApplet pApplet, int leftMargin, int topMargin, int rightMargin, int bottomMargin, int pageWidth, int pageHeight)
           
RiPageLayout(processing.core.PApplet pApplet, java.awt.Rectangle rect, int pageWidth, int pageHeight)
           
 
Method Summary
 RiPageLayout copy()
           
 void delete()
           
 void drawGuides()
           
 void drawGuides(processing.core.PGraphics p)
           
 int getBottomMargin()
           
 RiText getFooter()
           
 RiText getHeader()
           
 int getIndentSize()
           
 float getLeading()
          Returns the current leading, or -1 if using the defaults
 int getLeftMargin()
           
 RiText[] getLines()
           
 int getPageHeight()
           
 int getPageNo()
           
 int getPageWidth()
           
 java.lang.String getRemainingText()
           
 int getRightMargin()
           
 java.awt.Rectangle getTextRectangle()
           
 float getTextX()
           
 float getTextY()
           
 int getTopMargin()
           
 RiText[] getWords()
           
 int layout(processing.core.PFont pf, java.lang.String text)
          Creates an array of RiText, one per line from the input text and lays it out on the page.
 int layout(java.lang.String text)
          Creates an array of RiText, one per line from the input text and lays it out on the page.
 void layoutFromFile(processing.core.PFont pf, java.lang.String fileName)
          Creates an array of RiText, one per line from the text loaded from the specified 'fileName', and lays it out on the page according to the specified font.
static void main(java.lang.String[] args)
           
 void setFooter(RiText footer)
           
 void setFooter(java.lang.String footerText)
           
 void setHeader(RiText header)
           
 void setHeader(java.lang.String headerText)
           
 void setIndentFirstParagraph(boolean indentFirstParagraph)
          Whether to add an indent before the first paragraph
 void setIndents(int indents)
           
 void setIndentSize(int indentSize)
           
 void setLeading(float leading)
          Sets the leading.
 void setLines(RiText[] lines)
           
 void setPageHeight(int pageHeight)
           
 void setPageNo(int pageNumber)
           
 void setPageWidth(int pageWidth)
           
 void setParagraphSpacing(float lead)
          Sets the amount of additional lead to add between paragraphs
 void setTextColor(float[] color)
           
 void showPageNumbers(boolean showPageNumbers)
           
 java.lang.String toString()
           
 
Methods inherited from class rita.RiObject
dispose, getId, getPApplet, nextId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_LEADING

public static float DEFAULT_LEADING
amount of lead to use between lines (default is twice the font-height)


DEFAULT_PARAGRAPH_INDENT

public static int DEFAULT_PARAGRAPH_INDENT
# of (space-width) characters to use as a paragraph indent (default=0)


DEFAULT_PARAGRAPH_SPACING

public static float DEFAULT_PARAGRAPH_SPACING
amount of additional lead to add between paragraphs (default is 0)


DEFAULT_INDENT_FIRST_PARAGRAPH

public static boolean DEFAULT_INDENT_FIRST_PARAGRAPH
whether to add an indent to first paragraph for a page layout (default true)

Constructor Detail

RiPageLayout

public RiPageLayout(processing.core.PApplet pApplet,
                    int leftMargin,
                    int topMargin,
                    int rightMargin,
                    int bottomMargin)

RiPageLayout

public RiPageLayout(processing.core.PApplet pApplet,
                    int leftMargin,
                    int topMargin,
                    int rightMargin,
                    int bottomMargin,
                    int pageWidth,
                    int pageHeight)

RiPageLayout

public RiPageLayout(processing.core.PApplet pApplet,
                    java.awt.Rectangle rect,
                    int pageWidth,
                    int pageHeight)
Method Detail

layoutFromFile

public void layoutFromFile(processing.core.PFont pf,
                           java.lang.String fileName)
Creates an array of RiText, one per line from the text loaded from the specified 'fileName', and lays it out on the page according to the specified font.


layout

public int layout(java.lang.String text)
Creates an array of RiText, one per line from the input text and lays it out on the page.

Returns:
number of lines on the page

layout

public int layout(processing.core.PFont pf,
                  java.lang.String text)
Creates an array of RiText, one per line from the input text and lays it out on the page.

Returns:
number of lines on the page

copy

public RiPageLayout copy()

delete

public void delete()

drawGuides

public void drawGuides()

drawGuides

public void drawGuides(processing.core.PGraphics p)

getTopMargin

public int getTopMargin()

getLeftMargin

public int getLeftMargin()

getRightMargin

public int getRightMargin()

getBottomMargin

public int getBottomMargin()

getTextRectangle

public java.awt.Rectangle getTextRectangle()

getTextX

public float getTextX()

getTextY

public float getTextY()

getPageWidth

public int getPageWidth()

setPageWidth

public void setPageWidth(int pageWidth)

getPageHeight

public int getPageHeight()

setPageHeight

public void setPageHeight(int pageHeight)

getHeader

public RiText getHeader()

setHeader

public void setHeader(RiText header)

setHeader

public void setHeader(java.lang.String headerText)

getFooter

public RiText getFooter()

setFooter

public void setFooter(RiText footer)

showPageNumbers

public void showPageNumbers(boolean showPageNumbers)

setFooter

public void setFooter(java.lang.String footerText)

setPageNo

public void setPageNo(int pageNumber)

getPageNo

public int getPageNo()

setLines

public void setLines(RiText[] lines)

getLines

public RiText[] getLines()

getWords

public RiText[] getWords()

setIndentSize

public void setIndentSize(int indentSize)

getIndentSize

public int getIndentSize()

getRemainingText

public java.lang.String getRemainingText()

getLeading

public float getLeading()
Returns the current leading, or -1 if using the defaults


setLeading

public void setLeading(float leading)
Sets the leading. Use -1 to reset to default leading


setIndents

public void setIndents(int indents)

setParagraphSpacing

public void setParagraphSpacing(float lead)
Sets the amount of additional lead to add between paragraphs


setIndentFirstParagraph

public void setIndentFirstParagraph(boolean indentFirstParagraph)
Whether to add an indent before the first paragraph


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setTextColor

public void setTextColor(float[] color)

main

public static void main(java.lang.String[] args)