How do I set tab stops in a workspace?

Ned Konz ned at squeakland.org
Thu Dec 23 18:46:05 UTC 2004


On Thursday 23 December 2004 9:35 am, Stoffel, Andrew wrote:
> I'm assuming that it is just me and that this is so simple that
> everyone else just knows how to do this intuitively but I can't
> find it and would appreciate a pointer or two...
>
> The default tab stops in a Workspace seem to be 4 characters apart.
> I want to change that but I haven't figured it out...

Since the text morphs can use proportional fonts, there is no number of 
characters that corresponds to a tab. That would only work with monospaced 
characters.

Instead, there are positions associated with the tab stops.

This is done in the CharacterScanner, which is where the positioning of 
characters happens. Look at CharacterScanner>>plainTab.

Anyhow, the definitions of the tabs are set in each TextStyle. They're set in 
TextStyle>>newFontArray: and used in nextTabXFrom:leftMargin:rightMargin:

And it appears that nothing changes them once set, so their definition is 
fixed in the TextStyle class variables DefaultTabsArray and 
DefaultMarginTabsArray.

DefaultTabsArray contains multiples of 24; these would be pixels.

So I suppose you could change the tabs in a particular TextStyle using the 
attached code.

However, it's a bit more complicated than that...

Since the Workspace doesn't use the standardCodeFont (why?), and since the 
PluggableTextMorph uses #beAllFont, which makes a new TextStyle from a single 
font (and so doesn't look at the associated TextStyle and its tabs) it gets a 
little more complicated.

Try the two attached changesets.

-- 
Ned Konz
http://bike-nomad.com/squeak/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WorkspaceUseCodeFont-nk.2.cs.gz
Type: application/x-gzip
Size: 790 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20041223/83102e70/WorkspaceUseCodeFont-nk.2.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SettableTabWidth-nk.1.cs.gz
Type: application/x-gzip
Size: 766 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20041223/83102e70/SettableTabWidth-nk.1.cs.bin


More information about the Squeak-dev mailing list