Persisting TextMorph change the size of the text

Chris Muller asqueaker at gmail.com
Sun Jul 15 16:34:26 UTC 2007


Hi Hilaire,

Magma does indeed support StrikeFonts by way of the underlying
serialization framework, "Ma object serialization".  Several kinds of
Squeak Morphic elements require special pre/post serialization, and it
is included for StrikeFonts out of the box.

The process for Magma committing/reading a StrikeFont is:

  1) serialize the StrikeFont to a MaSerializedGraphBuffer
  2) write the MaSerializedGraphBuffer to disk
  3) read the MaSerializedGraphBuffer from disk
  4) materialize a StrikeFont from the MaSerializedGraphBuffer

As you can guess, steps 2 and 3 very likely have nothing to do with
the problem.  Therefore, the first thing to do is to simplify the
problem by getting Magma out of the picture and focusing on the
serialization/materialization steps.

There is a method for doing exactly this, MaObjectSerializer
class>>#testMaterialize:.  It simply performs steps 1 and 4, above,
which you may try with your StrikeFont:

  MaObjectSerializer testMaterialize: myStrikeFont

and see if it exhibits the same undesired transformation.  My guess is it will.

Next, look at the special-hook methods for StrikeFont and
StrikeFontSet, each under the category, "*ma object serialization".
Be sure to look at both the instance and class-side categories.

I was not able to reproduce the problem, but I believe from here you
will be able to find the cause and solution to the problem in your
image.  Would you mind sharing what you find?

Regards,
  Chris


On 7/15/07, Hilaire Fernandes <hilaire at ofset.org> wrote:
> Hilaire Fernandes a écrit :
> > I have found this strange bug: when persisting a TextMorph (System set
> > with default font to Accujen 10), when I fetch it back from the DB its
> > font size is Accujen 9 and not 10 anymore
> >
> > A simple code like that exposes the problem (close the session between
> > the two statements to effectively get the text morph from the database):
> >
> > (session addBranch: #test with: 'HELLO' asTextMorph ) openInWorld textStyle
> >  ==> a TextStyle Accujen10
> >
> > Then fetching back after a full close of the DB:
> >
> > (session branch: #test) textStyle
> >  ==> a TextStyle Accujen09
> >
> >
> > Any idea ?
> >
> > Hilaire
>
> Some more elements:
>
> TextStyle::fontArray
> an Array(a StrikeFont(Accujen09 12) a StrikeFont(Accujen10 12) a
> StrikeFont(Accujen12 15) a StrikeFont(Accujen14 17) a
> StrikeFont(Accujen18 22) a StrikeFont(Accujen24 30))
>
> and
> TextStyle::fontArray
> an Array(a StrikeFont(Accujen09 12) a StrikeFont(Accujen09 12) a
> StrikeFont(Accujen12 15) a StrikeFont(Accujen14 17) a
> StrikeFont(Accujen18 22) a StrikeFont(Accujen24 30))
>
>
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>


More information about the Magma mailing list