In Files

Parent

StringFormat

The StringFormat class is used to describe how strings should be drawn within a given area of screen. This includes the way that the strings are justified, word-wrapped and/or clipped to fit a specific space.

Public Class Methods

new click to toggle source

Creates a new StringFormat object. By default this will draw Strings that are justified to the top-left, word-wrapped, and clipped only by the bottom margin of the area in which they are drawn (only if they are too large to fit, of course!)

No arguments are taken - any changes to the format specification are defined using subsequent method calls.

# File Test Classes.rb, line 55
def self.new
  #DUMMY
end

Public Instance Methods

setAlignment(String) click to toggle source

Sets the StringFormat's attribute for alignment in the left-right dimension. The option is set using a short String descriptor, which should be one of the following...

  • "left" or "near" -> Text abuts the left hand border.

  • "centre" or "middle" -> Equal spacing to the left and to the right,

  • "right" or "far" -> Text abuts the right hand border.

# File Test Classes.rb, line 69
def setAlignment
  #DUMMY
end
setFlags(Integer) click to toggle source

Allows several custom options to be set for determining how texts wraps and/or overflows it allotted area. Each takes the form of a numeric code - multiple options may be set by adding their codes together, and using the sum as the argument...

  • 1 -> Draw text right to left rather than left to right.

  • 2 -> Draw text vertically (individual characters are not rotated).

  • 4 -> Allows ascenders and descenders of characters to overlap the border.

  • 32 -> Show unicode layout characters.

  • 1024 -> Use an alternative font for characters that the current font does not include. By default a "no glyph" character is displayed.

  • 2048 -> Include white space at the end of lines when measuring text.

  • 4096 -> Disable word-wrapping.

  • 8192 -> Display only complete text lines- do not split them by including extra line breaks,

Note that some of these settings may interact with each other, and with the other alignment attributes. See pages 160-162 of the User Guide for more details.

# File Test Classes.rb, line 112
def setFlags
  #DUMMY
end
setLineAlignment(String) click to toggle source

Sets the StringFormat's attribute for aligning lines in the up-down dimension. The option is set using a short String descriptor, which should be one of the following...

  • "top" or "near" -> Text abuts the top border, but may overflow at the bottom.

  • "centre" or "middle" -> Equal spacing above and below the text - or equal overflow top and bottom.

  • "bottom" or "far" -> Text abuts the lower border (but may overflow at the top)

# File Test Classes.rb, line 86
def setLineAlignment
  #DUMMY
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.