Looking over the documentation:
http://wiki.github.com/sorccu/cufon/api
One thing you could try is simply select a font and/or font-size for the crawler that accurately reflects the size (width especially) it will be after Cufon.replace(). If setting a different font-size in the css adversely affects how Cufon transforms the text, you can probably compensate by using the fontSize option for Cufon.replace().
The documentation also gives another possibility. You might be able to use Cufon.now(). If it would work, I'm thinking something like (change your existing cufon init thinger, see highlighted red):
Code:
<script src="/sites/all/themes/aea/cufon-yui.js" type="text/javascript"></script>
<script src="/sites/all/themes/aea/TradeGothic1_700.font.js" type="text/javascript"></script>
<script type="text/javascript">
Cufon.replace('#home_featured .block h3', { fontFamily: 'TradeGothic1' });
Cufon.replace('h2.title', { fontFamily: 'TradeGothic1' });
Cufon.replace('#mycrawler', { fontFamily: 'TradeGothic1' });
</script>
This should target the uninitialized crawler. Then add to the crawler init:
Code:
<script type="text/javascript">
Cufon.now();
marqueeInit({
uniqueid: 'mycrawler',
style: {
'margin-top': '0px',
'color': '#5280ba',
'width': '962px',
'font-size': '28px',
'font-weight': 'normal',
'text-transform': 'uppercase'
},
inc: 1, //speed - pixel increment for each iteration of this marquee's movement
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
moveatleast: 1,
neutral: 0,
noAddedSpace: true,
savedirection: true
});
</script>
Two considerations:
- I'm assuming this will not be too soon for the rest of the page because all cufon elements will have been parsed by that point.
- I'm also assuming that cufon will be quick enough that once the crawler starts to initialize, the true width of the trains will be apparent to it. And that the browser can accurately judge the width of the cufon transformed elements.
Bookmarks