Squeak Class Documentation category index | class index  
 
TextStyle
  category: Graphics-Text
  superclass: Object
  subclasses:

A textStyle comprises the formatting information for composing and displaying a unit (usually a paragraph) of text. Typically one makes a copy of a master textStyle (such as TextStyle default), and then that copy may get altered in the process of editing. Bad things can happen if you do not copy first.

Each of my instances consists of...
fontArray An array of StrikeFonts
fontFamilySize unused
lineGrid An integer; default line spacing for paragraphs
baseline An integer; default baseline (dist from line top to bottom of an 'a')
alignment An integer; text alignment, see TextStyle alignment:
firstIndent An integer; indent of first line in pixels
restIndent An integer; indent of remaining lines in pixels
rightIndent An integer; indent of right margin rel to section
tabsArray An array of integers giving tab offsets in pixels
marginTabsArray An array of margin tabs
leading An integer giving default vertical line separation

For a concrete example, look at TextStyle default copy inspect

instance methods
  Disk I/O
  storeDataOn:
veryDeepCopyWith:

  accessing
  alignment
alignment:
alignmentSymbol
baseline
baseline:
centered
defaultFont
firstIndent
firstIndent:
fontNamed:
fontNames
fontNamesAndSizes
fontNamesWithPointSizes
justified
leading
leading:
leftFlush
lineGrid
lineGrid:
printOn:
restIndent
restIndent:
rightFlush
rightIndent
rightIndent:

  comparing
  =
species

  default font
  defaultFontIndex
defaultFontIndex:

  fonts and font indexes
  collectionFromFileNamed:
consistOnlyOf:
flushFonts
fontIndexOf:
fontIndexOfSize:
fontOfPointSize:
fontOfSize:

  object fileIn
 

  private
  consolidate
fontArray
fontAt:
fontAt:put:
gridForFont:withLead:
marginTabAt:side:
newFontArray:

  tabs and margins
  clearIndents
leftMarginTabAt:
nextTabXFrom:leftMargin:rightMargin:
rightMarginTabAt:
tabWidth

class methods
  constants
  default
defaultFont
named:

  instance creation
  changeDefaultFontSizeBy:
fontArray:
initDefaultFontsAndStyle
new

instance methods
  Disk I/O top  
 

storeDataOn:

The shared arrays in tabsArray and marginTabsArray are the globals DefaultTabsArray and DefaultMarginTabsArray. DiskProxies will be substituted for these in (Array objectForDataStream:).


 

veryDeepCopyWith:

All inst vars are meant to be shared


  accessing top  
 

alignment

Answer the code for the current setting of the alignment.


 

alignment:

Set the current setting of the alignment to be anInteger:
0=left flush, 1=right flush, 2=centered, 3=justified.


 

alignmentSymbol

Answer the symbol for the current setting of the alignment.


 

baseline

Answer the distance from the top of the line to the bottom of most of the
characters (by convention, bottom of the letter 'A').


 

baseline:

Set the distance from the top of the line to the bottom of most of the
characters.


 

centered


 

defaultFont


 

firstIndent

Answer the horizontal indenting of the first line of a paragraph in the
style of the receiver.


 

firstIndent:

Set the horizontal indenting of the first line of a paragraph in the style
of the receiver to be the argument, anInteger.


 

fontNamed:

TextStyle default fontNamed: 'TimesRoman10'


 

fontNames

TextStyle default fontNames


 

fontNamesAndSizes

TextStyle default fontNames


 

fontNamesWithPointSizes


 

justified


 

leading

Leading (from typographers historical use of extra lead (type metal))
is the extra spacing above and beyond that needed just to accomodate
the various font heights in the set.


 

leading:


 

leftFlush


 

lineGrid

Answer the relative space between lines of a paragraph in the style of
the receiver.


 

lineGrid:

Set the relative space between lines of a paragraph in the style of the
receiver to be the argument, anInteger.


 

printOn:

Append to the argument, aStream, a sequence of characters that
identifies the receiver.


 

restIndent

Answer the indent for all but the first line of a paragraph in the style
of the receiver.


 

restIndent:

Set the indent for all but the first line of a paragraph in the style of the
receiver to be the argument, anInteger.


 

rightFlush


 

rightIndent

Answer the right margin indent for the lines of a paragraph in the style
of the receiver.


 

rightIndent:

Answer the right margin indent for the lines of a paragraph in the style
of the receiver to be the argument, anInteger.


  comparing top  
 

=

Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.


 

species

Answer the preferred class for reconstructing the receiver. For example,
collections create new collections whenever enumeration messages such as
collect: or select: are invoked. The new kind of collection is determined by
the species of the original collection. Species and class are not always the
same. For example, the species of Interval is Array.


  default font top  
 

defaultFontIndex


 

defaultFontIndex:


  fonts and font indexes top  
 

collectionFromFileNamed:

Read the file. It is an TextStyle whose StrikeFonts are to be added to the system. (Written by fooling SmartRefStream, so it won't write a DiskProxy!) These fonts will be added to the master TextSytle for this font family.
To write out fonts:
| ff | ff _ ReferenceStream fileNamed: 'new fonts'.
TextConstants at: #forceFontWriting put: true.
ff nextPut: (TextConstants at: #AFontName).
'do not mix font families in the TextStyle written out'.
TextConstants at: #forceFontWriting put: false.
ff close.
To read: (TextStyle default collectionFromFileNamed: 'new fonts')
*** Do not remove this method ***


 

consistOnlyOf:


 

flushFonts

Clean out the fonts, an aid when snapshotting claims too many are
holding onto Display.


 

fontIndexOf:


 

fontIndexOfSize:

Returns an index in fontArray of the font with height <= desiredHeight


 

fontOfPointSize:


 

fontOfSize:

See fontIndexOfSize.
Returns the actual font. Leading not considered.


  object fileIn top  

  private top  
 

consolidate

If this style includes any fonts that are also in the default style,
then replace them with references to the default ones.


 

fontArray

Only for writing out fonts, etc. 8/16/96 tk


 

fontAt:

This is private because no object outside TextStyle should depend on the
representation of the font family in fontArray.


 

fontAt:put:

Automatically grow the array. 8/20/96 tk


 

gridForFont:withLead:

Force whole style to suit one of its fonts. Assumes only one font referred
to by runs.


 

marginTabAt:side:

The marginTabsArray is an Array of tuples. The Array is indexed
according to the marginIndex, the 'nesting' level of the requestor.
sideIndex is 1 for left, 2 for right.


 

newFontArray:

Currently there is no supporting protocol for changing these arrays. If an editor wishes to implement margin setting, then a copy of the default should be stored with these instance variables.
, Make size depend on first font.


  tabs and margins top  
 

clearIndents

Reset all the margin (index) settings to be 0.


 

leftMarginTabAt:

Set the 'nesting' level of left margin indents of the paragraph in the
style of the receiver to be the argument, marginIndex.


 

nextTabXFrom:leftMargin:rightMargin:

Tab stops are distances from the left margin. Set the distance into the
argument, anX, normalized for the paragraph's left margin.


 

rightMarginTabAt:

Set the 'nesting' level of right margin indents of the paragraph in the
style of the receiver to be marginIndex.


 

tabWidth

Answer the width of a tab.


class methods
  constants top  
 

default

Answer the system default text style.


 

defaultFont

Answer the default system font


 

named:


  instance creation top  
 

changeDefaultFontSizeBy:

TextStyle changeDefaultFontSizeBy: 1


 

fontArray:

Answer an instance of me with fonts those in the argument, anArray.


 

initDefaultFontsAndStyle

This provides the system with 10 and 12-pt basal fonts.
Bold and italic versions will be automatically generated as needed


 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.