aScratchPangoFont-Problem in ’14-Jan-15′ scratch

Remark: For raspbian ‘jessie’ and scratch “Scratch 1.4 (linux) of 2015-09-15”, this problem is solved.

In scratch “Scratch 1.4 of 14-Jan-15”, as provided in raspbian for Raspberry Pi, there is a serious bug which prevents projects from loading. This affects scratch projects which are stored/reloaded multiple times, and only scratch projects which use texts in new created sprite costumes. The error popup is “primSetFont:size:bold:italic:antialias: failed”

error

Problem description

When loading a project, occasionally the following problem occurs

pango_001

The error message is “primSetFont”.

Reproduce the problem

In a new project, create a new sprite with the edit-button. Add a text to this sprite. Close the editor and save the project –> “x00”. Close scratch.

Start scratch, open project “x00”.
Open the costume with the font,, click to the ‘T’ext button. There is “a ScratchPan…” displayed. Close editor with ‘cancel’. Save project as “x01”. Close scratch.

Start scratch, open project “x01”, save as “x02”. Close scratch.
Repeat this till you reach “x05”. When loading “x05”, you should get this problem.

Technical Details

When looking to the project.sb-file of an affected project, there is a sequence shown where the original ‘DejaVu’-Font is wrapped into a ‘s ScratchPangoFont’ multiple times.
This wrapping seems to occur each time on save, and after a few times the length exceeds some limit. This happens with all fonts, I found no exceptions.

sb

project.sb file in a plain text editor.

Error handling

When nothing important is in the project, just discard it.

When nothing important is in a costume, just discard it.

When work needs to be restored, click to the ‘proceed’-Button in the error messages. When one error message is away, there are quite a lot new of them might pop up. Always click ‘proceed’.

Then, look for background or sprites where fonts are used. You see it in the thumbnail preview in the costume tab.

‘edit’ these costumes. The editor has problems to start, and you get again many of these popups. pango_002

pango_003

Editor window is displayed slowly, when it is back till you see the title bar of the editor “Paint Editor”, drag it around a little bit and the editor window will be redrawn to its usual appearance. Click to the ‘font’ button, this is the “T”-Button.

pango_004

You see  ‘a ScratchPan..’ in the font selector. Select a font from the selector. This clears the false value in this field. Commit the work with ‘ok’.

The sprite or background is restored. Now go ahead with the workaround procedure.

Workaround Procedure

Completed projects

If a project is completed, just avoid to save the project when leaving.

Projects during development

If the insertion of text is needed to costumes, then
– finalize the costume/background as usual.
– export the costume to a file. Right click on the thumbnail image and ‘export this costume’.

pango_007

Then, use the import function and load this file into the costumes. The difference is that this is a bitmap copy, not containing the font. The problem is, that editing the text is no longer possible.
Delete the costume with the font.

 Comments

There is also an error report on raspberrypi-Forum. Leave a comment there.

RaspberrPi forum