eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TextStyle':

Home

everywhere
www.exept.de
for:
[back]

Class: TextStyle


Inheritance:

   Object
   |
   +--TextStyle

Package:
stx:libcompat
Category:
Graphics-Support
Version:
rev: 1.3 date: 1999/11/18 13:45:51
user: cg
file: TextStyle.st directory: libcompat
module: stx stc-classLibrary: libcompat

Description:


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


Class protocol:

constants
o  default
Answer the system default text style.

o  named: familyName

instance creation
o  changeDefaultFontSizeBy: delta
TextStyle changeDefaultFontSizeBy: 1

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

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

o  new


Instance protocol:

Disk I/O
o  storeDataOn: aDataStream
Store myself on a DataStream. This is a low-level DataStream/ReferenceStream method. See also objectToStoreOnDataStream. Need this to share tabsArray and marginTabsArray. Fonts will take care of themselves.

o  veryDeepCopyWith: deepCopier
All inst vars are meant to be shared

accessing
o  = other

o  alignment
Answer the code for the current setting of the alignment.

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

o  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').

o  baseline: anInteger
Set the distance from the top of the line to the bottom of most of the
characters.

o  centered

o  defaultFont
Answer the first font in the font family.

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

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

o  fontNamed: fontName
TextStyle default fontNamed: 'TimesRoman10'

o  fontNames
TextStyle default fontNames

o  fontNamesAndSizes
TextStyle default fontNames

o  justified

o  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.

o  leading: yDelta

o  leftFlush

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

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

o  printOn: aStream

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

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

o  rightFlush

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

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

fonts and font indexes
o  collectionFromFileNamed: fileName
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 ***

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

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

o  fontOfSize: aHeight
See fontIndexOfSize.
Returns the actual font. Leading not considered.

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

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

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

o  fontAt: index put: font
Automatically grow the array. 8/20/96 tk

o  gridForFont: fontIndex withLead: leadInteger
Force whole style to suit one of its fonts. Assumes only one font referred
to by runs.

o  marginTabAt: marginIndex side: sideIndex
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.

o  newFontArray: anArray
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
o  clearIndents
Reset all the margin (index) settings to be 0.

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

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

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

o  tabWidth
Answer the width of a tab.



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 22:39:30 GMT