On 2012-04-22, at 17:53, Daniel Lyons wrote:

> 
> On Apr 21, 2012, at 1:19 PM, Camillo Bruni wrote:
>> well you could also plug my readline implementation to any text morph and
>> set the a monospace font as default for code :) (that's what I have anyway).
>> 
>> Manually creating a text morph an changing it's font to some fixed-width
>> version is not that hard. And then depending on your needs you would simply
>> edit / change the underlying text (in this case with even my readline 
>> implementation)...
> 
> I believe you but I seem to need a bit more explicit hand-holding. For 
> example, when I create a new text morph, it winds up on the screen by itself 
> with no enclosing window. Using the code derived from the TextMorph class 
> comment:
> 
> font := TextFontReference toFont: (StrikeFont familyName: 'Pragmata Pro' 
> size: 16).
> tMorph := TextMorph new.
> t1 := 'This is fixed-width' asText addAttribute: font.
> tMorph contents: t1.
> tMorph openInHand.
> 
> It doesn't seem to recognize Pragmata Pro or any other font name I put in, I 
> always get the default font I set in my preferences (which is a system font 
> and works fine). I see there's a FixedFaceFont class, but it looks like a 
> completely different sort of thing.

indeed maybe a workspace will do just fine then :), sadly I'm not that much 
into morphic hence my partial approach here (that's why I personally find it 
far easier to directly use the terminal)...

- check that you have freetype enabled in your settings (otherwise system fonts 
won't be recognized)
- as a pragmatic solution I'd change the coding font globally to fixed-width 
(default in my images since I cannot program in a non mono-spaced font :P)

"open a new workspace "
ws := Workspace openContents: 'Initial Contents'
" update the contents of the workspace"
ws contents: 'new Contents'


> I also don't see how to get started with your Readline implementation. I'm 
> sure I'd like to use it eventually but I want to get something basic working 
> that I can understand first.

for the readline stuff check the test (that's generally the best place to see 
how code works ;) 
see class: RLReadlineTest 

a small example is given in RLReadline >> #readlineExample

the basic principle is that you move around a cursor and put characters / 
strings there:

RLReadline >> #write:
RLReadline >> #writeAll:

I know the readline implementation is quite complex for what it does, but you 
shouldn't bother too much and simply rely on the public interface and the 
example use-cases provided by the tests.



best
cami

Reply via email to