Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-nice.49.mcz ==================== Summary ==================== Name: MorphicExtras-nice.49 Author: nice Time: 5 October 2009, 10:53:56 am UUID: 1cb0c94f-987d-42a7-92f5-3444dc44b672 Ancestors: MorphicExtras-nice.48 Fix http://bugs.squeak.org/view.php?id=6972 Some TextConstants are hardcoded in PostscriptCharacterScanner I am more than a Number, I am a TextConstant... =============== Diff against MorphicExtras-nice.48 =============== Item was changed: ----- Method: PostscriptCharacterScanner>>displayLine:offset:leftInRun: (in category 'displaying') ----- displayLine: line offset: baseOffset leftInRun: leftInRun | drawFont offset aText string s doJustified | self setTextStylesForOffset: ((line first) + 1). " sets up various instance vars from text styles " drawFont := self font. offset := baseOffset. offset := offset + (line left @ (line top + line baseline - drawFont ascent )). offset := offset + ((self textStyle alignment caseOf:{ + [Centered] -> [ line paddingWidth /2 ]. + [RightFlush] -> [ line paddingWidth ] } otherwise:[0]) @ 0). - [2] -> [ line paddingWidth /2 ]. - [1] -> [ line paddingWidth ] } otherwise:[0]) @ 0). canvas moveto: offset. aText := paragraph text copyFrom: line first to: line last. + doJustified := (paragraph textStyle alignment = Justified) - doJustified := (paragraph textStyle alignment = 3) and: [ (paragraph text at:line last) ~= Character cr and: [aText runs runs size = 1]]. string := aText string. aText runs withStartStopAndValueDo: [:start :stop :attributes | self setTextStylesForOffset: (start + line first - 1). " sets up inst vars from text styles " s := string copyFrom: start to: stop. drawFont := self font. canvas setFont: drawFont. canvas textStyled: s at: offset "<--now ignored" font: drawFont "<--now ignored" color: foregroundColor justified: doJustified "<-can't do this now for multi-styles" parwidth: line right - line left. ]. ! Item was changed: Object subclass: #PostscriptCharacterScanner instanceVariableNames: 'canvas paragraph bounds curPos font foregroundColor emphasis' classVariableNames: '' + poolDictionaries: 'TextConstants' - poolDictionaries: '' category: 'MorphicExtras-Postscript Canvases'! !PostscriptCharacterScanner commentStamp: '<historical>' prior: 0! I am a simple character scanner that forwards text-drawing commands to my canvas. Despite the name, it should also work with other Canvases that actually implement the text-drawing commands (which the basic FormCanvas does not). Style text support currently includes color, centering, fonts and emphasis. Not yet supported are embedded objects, full justification and probably some others as well. Tabs aren't supported properly, but rather hacked in the Postscript Header provided by PostscriptCanvas to be equivalent to 4 space. mpw. ! |
Free forum by Nabble | Edit this page |