Skip to main content
Participating Frequently
May 20, 2013
Question

CreateJS export results in garbled text elements

  • May 20, 2013
  • 1 reply
  • 1868 views

When I export from CreateJS, the text either doesn't show up, or it's not where it should be, or, about 25% of the time, it's right!

What do I need to do to normalize the behavior of text elements? Perhaps properties need to be set?

I've tried setting the element's face to "_sans", but when I inspect the element's properties, it doesn't seem to change them.

txt.setTextAttr("face","_sans");

Also, how to I preserve the width so text doesn't wrap in the exported HTML version?

Ideally I could still control if they ended up as dynamic, HTML text or static canvas text.

Thanks!

This topic has been closed for replies.

1 reply

ron700
Inspiring
May 20, 2013

Maybe this is the same problem jbabertntn encountered (http://forums.adobe.com/message/5325604#5325604).

The latest Toolkit v1.2 solved some text-problems but only left-aligned text rotates ok.

The fontface is copied from the Text-object.

Since I know you master jsfl: The fontface can be set with jsfl by selecting the text-object and execute:

fl.getDocumentDOM().setElementTextAttr('face', '_sans');

But _sans is not a html-font and the toolkit doesn't embed fonts, so fonts have be added to the html in the css, like this:

<style type="text/css">

@font-face {

  font-family: Tahoma;

  src: url('fonts/tahoma.ttf');

}

@font-face {

  font-family: Arial;

  src: url('fonts/arial.ttf');

}

</style>

Where fonts/tahoma.ttf and fonts/arial.ttf are referring to fonts on your website (not all browsers support @font-face).

The DOMElement for text is recommended (but I could not get it to work for what I needed).

Here is an example:

http://small-codes.com/jouer-avec-les-domelements-dans-createjs-animez-vos-formulaires/?lang=en