|
Class: TextStyle
Object
|
+--TextStyle
- Package:
- stx:libcompat
- Category:
- Graphics-Support
- Version:
- rev:
1.14
date: 2024/01/22 14:44:02
- user: cg
- file: TextStyle.st directory: libcompat
- module: stx stc-classLibrary: libcompat
DO NOT DIRECTLY REFER TO THIS CLASS OR USE IT OTHERWISE IN YOUR CODE:
ST-80 compatibility class.
This may be required when existing code has to be ported to ST/X;
however, it may not be complete and more protocol may be added in the future.
The code here was created when public domain code (Manchester) had to
be ported to ST/X and missing classes/methods were encountered, and code added
by reasoning 'what the original class could probably do there'.
This is currently not used by ST/X itself.
copyrightCOPYRIGHT (c) 1999 by Claus Gittinger / eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
constants
-
default
-
Answer the system default text style.
-
defaultFont
-
-
named: familyName
-
instance creation
-
changeDefaultFontSizeBy: delta
-
TextStyle changeDefaultFontSizeBy: 1
-
fontArray: anArray
-
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
Usage example(s):
TextStyle initDefaultFontsAndStyle.
|
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
Disk I/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.
-
veryDeepCopyWith: deepCopier
-
All inst vars are meant to be shared
accessing
-
= other
-
(comment from inherited method)
return true if the receiver and the arg have the same structure.
Notice:
This method is partially open coded (inlined) by the compiler(s)
identical objects are always considered equal.
redefining it may not work as expected.
-
alignment
-
Answer the code for the current setting of the alignment.
-
alignment: anInteger
-
Set the current setting of the alignment to be anInteger:
0=left flush, 1=centered, 2=right flush, 3=justified.
-
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: anInteger
-
Set the distance from the top of the line to the bottom of most of the
characters.
-
centered
-
Modified (format): / 22-01-2024 / 15:35:26 / cg
-
defaultFont
-
Answer the first font in the font family.
-
firstIndent
-
Answer the horizontal indenting of the first line of a paragraph in the
style of the receiver.
-
firstIndent: anInteger
-
Set the horizontal indenting of the first line of a paragraph in the style
of the receiver to be the argument, anInteger.
-
fontNamed: fontName
-
TextStyle default fontNamed: 'TimesRoman10'
-
fontNames
-
TextStyle default fontNames
-
fontNamesAndSizes
-
TextStyle default fontNames
-
justified
-
Modified (format): / 22-01-2024 / 15:36:03 / cg
-
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: yDelta
-
Modified (format): / 22-01-2024 / 15:36:07 / cg
-
leftFlush
-
Modified (format): / 22-01-2024 / 15:36:10 / cg
-
lineGrid
-
Answer the relative space between lines of a paragraph in the style of
the receiver.
-
lineGrid: anInteger
-
Set the relative space between lines of a paragraph in the style of the
receiver to be the argument, anInteger.
-
printOn: aStream
-
(comment from inherited method)
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.
The default here is to output the receiver's class name.
BUT: this method is heavily redefined for objects which
can print prettier.
-
restIndent
-
Answer the indent for all but the first line of a paragraph in the style
of the receiver.
-
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.
-
rightFlush
-
Modified (format): / 22-01-2024 / 15:43:06 / cg
-
rightIndent
-
Answer the right margin indent for the lines of a paragraph in the style
of the receiver.
-
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
-
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 ***
-
flushFonts
-
Clean out the fonts, an aid when snapshotting claims too many are
holding onto Display.
Usage example(s):
TextStyle default flushFonts
|
-
fontIndexOfSize: desiredHeight
-
Returns an index in fontArray of the font with height <= desiredHeight
-
fontOfSize: aHeight
-
See fontIndexOfSize.
Returns the actual font. Leading not considered.
private
-
consolidate
-
If this style includes any fonts that are also in the default style,
then replace them with references to the default ones.
Usage example(s):
TextStyle allInstancesDo: [:s | s == TextStyle default ifFalse: [s consolidate]]
|
-
fontArray
-
Only for writing out fonts, etc. 8/16/96 tk
-
fontAt: index
-
This is private because no object outside TextStyle should depend on the
representation of the font family in fontArray.
-
fontAt: index put: font
-
Automatically grow the array. 8/20/96 tk
-
gridForFont: fontIndex withLead: leadInteger
-
Force whole style to suit one of its fonts. Assumes only one font referred
to by runs.
-
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.
-
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.
Usage example(s):
TextStyle allInstancesDo: [:ts | ts newFontArray: TextStyle default fontArray].
|
tabs and margins
-
clearIndents
-
Reset all the margin (index) settings to be 0.
-
leftMarginTabAt: marginIndex
-
Set the 'nesting' level of left margin indents of the paragraph in the
style of the receiver to be the argument, marginIndex.
-
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.
-
rightMarginTabAt: marginIndex
-
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.
|