From 9d292ba89bee9c00eae6f2c8878c9d95017de66e Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Sun, 15 Oct 2023 04:24:19 -0400 Subject: [PATCH] Literally embed Form when pretty-printing to a rich-text stream This commits lays the ground for implementing Notarfrancesco-style pretty-printing of multiline mathematical objects --- .../Form.extension.st | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 MachineArithmetic-MathNotation-Pharo/Form.extension.st diff --git a/MachineArithmetic-MathNotation-Pharo/Form.extension.st b/MachineArithmetic-MathNotation-Pharo/Form.extension.st new file mode 100644 index 000000000..9f8ae6b03 --- /dev/null +++ b/MachineArithmetic-MathNotation-Pharo/Form.extension.st @@ -0,0 +1,16 @@ +Extension { #name : #Form } + +{ #category : #'*MachineArithmetic-MathNotation-Pharo' } +Form >> printOn: aStream [ + aStream collectionSpecies = Text ifTrue: [ + aStream + withAttribute: (TextAnchor new anchoredMorph: self) + do: [ aStream nextPutAll: (String value: 1) ]. + ^self ]. + aStream + nextPutAll: self class name; + nextPut: $(; print: width; + nextPut: $x; print: height; + nextPut: $x; print: depth; + nextPut: $). +]