Image 3.7 current full version.
This method behaves contrary to the example included in the method, and contrary to my expectation.
The method forces foreground color to black and background to white. It goes to great lengths to do this to support a ColorForm with 2 colors, except that in the case of a TTCStyle it uses a Form with depth 32. It looks like a clear bug. I have yet to figure out how to create the form with all transparent pixels. The constructor creates it as black fill, and using "over" or other rules do not replace it with Color transparent.
Michael
asForm "Answer a Form made up of the bits that represent the receiver's displayable text." | theForm oldBackColor oldForeColor | oldBackColor _ backColor. oldForeColor _ foreColor. textStyle isTTCStyle ifTrue: [ theForm _ (Form extent: compositionRectangle extent depth: 32) offset: offset. theForm fill: theForm boundingBox rule: Form erase fillColor: Color transparent. ] ifFalse: [ theForm _ (ColorForm extent: compositionRectangle extent) offset: offset; colors: (Array with: (backColor == nil ifTrue: [Color transparent] ifFalse: [backColor]) with: (foreColor == nil ifTrue: [Color black] ifFalse: [foreColor])). backColor _ Color white. foreColor _ Color black. ]. self displayOn: theForm at: 0@0 clippingBox: theForm boundingBox rule: Form over fillColor: nil. backColor _ oldBackColor. foreColor _ oldForeColor. ^ theForm
"Example: | p | p _ 'Abc' asParagraph. p foregroundColor: Color red backgroundColor: Color black. p asForm displayOn: Display at: 30@30 rule: Form over"
"Michael Latta" lattam@mac.com wrote: To: "The general-purpose Squeak developers list" squeak-dev@lists.squeakfoundation.org Sent: Saturday, January 29, 2005 4:22 AM Subject: [BUG][Partial Fix] Paragraph>>asForm
Image 3.7 current full version.
"Example: | p | p _ 'Abc' asParagraph. p foregroundColor: Color red backgroundColor: Color black. p asForm displayOn: Display at: 30@30 rule: Form over"
This example works both in Morphic and in MVC when you use StrikeFonts. It does not work when you use TrueType Fonts. (3.8 gamma 6527) I think it is fair to say that the example became outdated with the introduction of support for TrueType fonts. An updated example should read:
"example: (coloring needs a StrikeFont) | p | p _ 'Abc' asParagraph. p textStyle: (TextStyle named: 'Accuny'). p foregroundColor: Color red backgroundColor: Color black. p asForm displayOn: Display at: 30@30 rule: Form over "
Greetings, Boris
squeak-dev@lists.squeakfoundation.org