Thank you for the help. I am not a Ruby programmer so it may take me a
while to comprehend the examples.
The effects you present in level3 text_fall.rb and text-size.rb are
exactly the type of effects I am trying to achieve. Looking at the code,
it appears you have used Actionscript to animate the characters rather
than Ruby itself. Using ming 0.3, I was able to do this with a
combination of SWFFont, SWFText, and SWFShape methods - no AS involved.
But that was then, so now I must try to adapt your methods to my PHP
code or learn Ruby and implement Rails.
I noticed in your Actionscript code for those two routines, you can
directly reference a font by name (not file) and it will be picked up by
the system's font server. However, in the level2/fonts.rb file, you use
the SWFFont.new() method which requires either a TTF or FDB file. In
PHP, the new SWFBrowserFont() accepts only a system's font name, not a
font file. Is there anything similar in Ruby? With Ruby, it seems to are
still stuck using FDB font files or non-proprietary and free TTF font
files to get around licensing issues.
Larry Dunbar
Pawel Karwowski - wrote:
Hello Larry.
I do not think, that SWFText supports BrowserFonts, it is (was)
possibly part of the
swf specification and if I recall correctly it is commented somewhere
in Ming source
code, so for animation effects we shall use embedded fonts only.
Ming-Ruby binary extension for Windows is based upon Ming-CVS code
from May 1 2009. I added some text effects examples to the /level3
folder and those samples use Browser Fonts.
Best wishes
Pawel Karwowski
On Fri, Oct 9, 2009 at 1:25 AM, Larry Dunbar <ldunbar@xxxxxxxxxx
<mailto:ldunbar@xxxxxxxxxx>> wrote:
Thanks for your help. I understand that I can use a SWFTextField
in place of static text in some instances. The main problem I am
having is when trying to animate the text. The following script is
ming.sourceforge.net/examples/animation.html
<http://ming.sourceforge.net/examples/animation.html>, modified to
use SWFBrowserFont:
=================================
<?php
$f = new SWFBrowserFont("Impact");
$string = "MING!";
$m = new SWFMovie(8);
$m->setRate(24.0);
$m->setDimension(520, 320);
$m->setBackground(251, 121, 34);
// This functions was based on the example from
// http://ming.sourceforge.net/examples/animation.html
function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string) {
global $f, $m;
$t = new SWFText();
$t->setFont($f);
$t->setColor($r, $g, $b, $a);
$t->setHeight(96);
$t->moveTo(-($t->getWidth($string)) / 2, 32);
$t->addString($string);
$i = $m->add($t);
$i->rotateTo($rot);
$i->moveTo($x, $y);
$i->scale($scale, $scale);
}
$colorr[1] = 255 * 0.85;
$colorg[1] = 255 * 0.85;
$colorb[1] = 255 * 0.85;
$colorr[2] = 255 * 0.9;
$colorg[2] = 255 * 0.9;
$colorb[2] = 255 * 0.9;
$colorr[3] = 255 * 0.95;
$colorg[3] = 255 * 0.95;
$colorb[3] = 255 * 0.95;
$colorr[4] = 255;
$colorg[4] = 255;
$c = 1;
$anz = 4;
for ($i = 0; $i < $anz; $i += 1) {
$x = 1040;
$y = 50 + $i * 30;
$size = ($i / 5 + 0.2);
$t[$i] = text($colorr[$c], $colorg[$c], $colorb[$c], 0xff, 0,
$x, $y, $size, $_GET['text']);
$c += $step;
}
$frames = 300;
for ($j = 0; $j < $frames; $j++) {
for ($i = 0; $i < $anz; $i++) {
$t[$i]->moveTo(260 + round(sin($j / $frames * 2 * pi() + $i) *
(50 + 50 * ($i + 1))), 160 + round(sin($j / $frames * 4 * pi() +
$i) * (20 + 20 * ($i + 1))));
$t[$i]->rotateTo(round(sin($j / $frames * 2 * pi() + $i / 10)
* 360));
}
$m->nextFrame();
}
header('Content-Type: application/x-shockwave-flash');
$m->output(0);
exit;
?>
=====================================
I am trying to develop text easing functions and need the test to
either support the moveTo() function (which SWFTextField does
not), or be able to convert each character to a shape (while
SWFShape does not support SWFBrowserFont). If I can do this with
a text field, I would be very grateful on how to accomplish it.
Re the gazb tests; In the Examples section, I'm having problems
with font drawing 2 (fontdrawing2.php), font drawing...
(fontmingdrawmany.php). Also in the Examples section, the chrome
example (chrome.php) does render properly (this is a separate
issue and not related to the font problem).
In the Misc section, the fonts test (font.php) works except for
SWFBrowserFont not seeming to support the Webdings font.
On another note, I installed Ruby and the ming extension from the
link you provided and the examples I've used so far seem to work.
Can you tell me which ming version this supports?
Larry Dunbar
strk wrote:
I confirm the current code doesn't let you associate
a browser font with a static text.
Why not using SWFTextField as a workaround ?
Could you point me to the gazb tests which aren't working
anymore ?
--strk;
On Sun, Oct 04, 2009 at 06:28:10PM -0400, Larry Dunbar wrote:
I am using the current XAMPP for Windows (version 1.7.2)
which has PHP 5.3 and MING 0.4.2. I am having great
difficulty using browser fonts. For example, the following
code snippet will produce an error when trying to set the
font for SWFText, but the SWFTextField works OK:
<?php
$font = new SWFBrowserFont("arial");
$txtfld = new SWFTextField(SWFTEXTFIELD_DRAWBOX);
$txtfld->setFont($font);
$txt = new SWFText();
$txt->setFont($font);
?>
The error being returned is:
*Warning*: SWFText::setFont() [swftext.setfont
<http://ming.com/swftext.setfont>]: Unable to find
property font in *E:\ming\new_file.php* on line *9*
*Fatal error*: SWFText::setFont() [<a
href='swftext.setfont'>swftext.setfont</a>]: Called object
is not an SWFFont in *E:\ming\new_file.php* on line *9
*I get the same error when trying to use
SWFShape->drawGlyph(). Can anyone provide a working
example for SWFText and SWFShape using browser fonts?
Please no C code since I'm using PHP. The examples
provided by gazb (which have helped me tremendously in the
past) do not work with ming 0.4.2.
Larry Dunbar
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer
Conference in SF, CA
is the only developer event you need to attend this year.
Jumpstart your
developing skills, take BlackBerry mobile applications to
market and stay ahead of the curve. Join us from November
9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Ming-users mailing list
Ming-users@xxxxxxxxxxxxxxxxxxxxx
<mailto:Ming-users@xxxxxxxxxxxxxxxxxxxxx>
https://lists.sourceforge.net/lists/listinfo/ming-users
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year.
Jumpstart your
developing skills, take BlackBerry mobile applications to market
and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ming-users mailing list
Ming-users@xxxxxxxxxxxxxxxxxxxxx
<mailto:Ming-users@xxxxxxxxxxxxxxxxxxxxx>
https://lists.sourceforge.net/lists/listinfo/ming-users
begin:vcard
fn:Larry Dunbar
n:Dunbar;Larry
org:LowTechGeezer.com
adr:;;4595 Rosebud St.;Cocoa;FL;32927;US
email;internet:ldunbar@xxxxxxxxxxxxxxxx
tel;work:(321) 482-5753
tel;home:(321) 482-5753
x-mozilla-html:TRUE
version:2.1
end:vcard
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ming-users mailing list
Ming-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ming-users