[squeak-dev] Inspector Custom Value Panes & Related

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Wed Sep 2 21:29:22 UTC 2020


Hi Tobias, thanks for the tips! :-)


> I think the "TextFontReference toFont:" and explicit "addAttribute:" are a bit involved; maybe something akin to Text>>#makeBoldFrom:to:/Text>>#allBold would be nice.


Would you expect such a Text>>#setFont:from:to: only to add a TextFontReference or also to remove all existing TextFontReferences from the interval?

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Tobias Pape <Das.Linux at gmx.de>
Gesendet: Mittwoch, 2. September 2020 22:04:38
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] Inspector Custom Value Panes & Related

Hi

> On 02.09.2020, at 21:14, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
>
> Hi Eric,
>
> > I can't seem to find MorphInspector in a current (5.3 here) image. Is this a separate package?
>
> MorphInspector, FormInspector, and a bunch of other small new improvements to the inspector framework have arrived in the Squeak Trunk just a few months ago! See http://forum.world.st/Please-try-out-Inspector-Refactoring-td5114974.html and https://squeak.org/downloads/#current-trunk-image-2:~:text=Current-,Trunk,-Image :-)
>
> > I find the whole relationship between a Text and TextStyle a bit confusing, especially where it comes to setting Fonts. It appears that there are lots of different "kinds" of Fonts, and there's a good amount of indirection so it's difficult to determine which kind of fonts (StrikeFont? TTFont?) "live" and how to see what's available and pick programmatically. Is there a good primer somewhere on Text/TextStyle?
>
> These are good questions others can probably answer better than I could do.
> This is all I can tell you:
>        • Font rendering in Squeak is difficult and the default font (DejaVu Sans) appears to be the only one that looks kind of nice in all sizes. I almost never choose a different font.
>        • To change the font in a Text, use something like:
> 'foo' asText
> addAttribute: (TextFontReference toFont: (StrikeFont
> familyName: 'Darkmap DejaVu Sans'
> pointSize: 20));
> openAsMorph

I'd suggest to use the TextStyle indirection, so you don't have to guess wether the font is a Strike font or a TTFont or whatever:

        'foo' asText
                addAttribute: (TextFontReference toFont: ((TextStyle named: 'Darkmap DejaVu Sans') fontOfSize: 20));
                openAsMorph


If you are just after changing the font used in a TextMorph (not the text itself), I'd use

        'foo' asTextMorph
                beAllFont: ((TextStyle named: 'Darkmap DejaVu Sans') fontOfSize: 20);
                openInHand


That way, the name string can be easily exchanged, such  as 'BitstreamVeraSans', or anything imported with the FontImporterTool

I think the "TextFontReference toFont:" and explicit "addAttribute:" are a bit involved; maybe something akin to Text>>#makeBoldFrom:to:/Text>>#allBold would be nice.


Best regards
        -Tobias


>
> > Also -- how can I disable editing of a TextMorph?
>
> See TextMorph >> #readOnly: or also Morph >> #lock to disable any interaction.
>
> Best,
> Christoph
> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Eric Gade <eric.gade at gmail.com>
> Gesendet: Mittwoch, 2. September 2020 17:01:45
> An: The general-purpose Squeak developers list
> Betreff: Re: [squeak-dev] Inspector Custom Value Panes & Related
>
> Hi Christoph,
>
> On Tue, Sep 1, 2020 at 7:32 PM Christoph Thiede <christoph.thiede at student.hpi.uni-potsdam.de> wrote:
>
> for displaying graphics in an inspector, have a look at MorphInspector (screenshot) or FormInspector (pixels). Custom interactive fields are not (yet?) supported, but in theory, you could subclass Inspector and override the relevant toolbuilder methods.
>
> I can't seem to find MorphInspector in a current (5.3 here) image. Is this a separate package?
>
>
> Regarding to your second question - why don't you use a TextMorphs? The composition of different formatting styles applied to a string is just what makes up a Text
>
> Aha, yes, I think I've looked into this before. I find the whole relationship between a Text and TextStyle a bit confusing, especially where it comes to setting Fonts. It appears that there are lots of different "kinds" of Fonts, and there's a good amount of indirection so it's difficult to determine which kind of fonts (StrikeFont? TTFont?) "live" and how to see what's available and pick programmatically. Is there a good primer somewhere on Text/TextStyle? Also -- how can I disable editing of a TextMorph?
>
> Thanks again




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200902/f0ae7a26/attachment.html>


More information about the Squeak-dev mailing list