On NME and fonts

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

On NME and fonts

TjD__
Greetings,

I am currently converting a flash game to iOS and have some troubles ( I already got the compile errors down to 84 from a few hundred caused by UInt and some keyboard/mouse related code that wasn't relevant for iOS ).


1)
"nme.text.Font does not have a constructor" What does this mean, is nme,text.Font not functional in NME ?Can I just remove the new Font line when not compiling into Flash with #if flash and will it still work ?

2)
flash.text.TextField does not have .getTextFormat() which I use to then set .font to my bold font
so now I have this :

//addboldness
if (AddBold)
{
                tfa = _tf.getTextFormat(); //This does not work
                tfa.font = boldFont;

        _tf.setTextFormat(tfa, boldStart, boldEnd); //I need tfa to make this work
}
Is there another way I could bolden text under NME ?

3)
nme.text.Font does not have have the field fontName which is required by the version of Flixel/Haxe that I use, not sure if there is an alternative means to get the fontName ?

I am using the NME 3.0.1 from haxelib. Please let me know what other information I can provide to shed light on this.

T.
Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

Gamehaxe
Hi,
1. Fonts on nme and flash are handled differently.  In flash, you package  
them
into an swf, and nme you use them as a file. So you going to need

#if !flash
    var font = new Font(filename);
#else
    // For flash, you can embed the font and it will "magically" appear
    //  and you can just refer to it by name, or get a handle with:
    flash.text.Font.enumerateFonts(...)
#end
You can use the nmml tool to handle these situations

2. getTextFormat has not been added yet.
   I think you can create a "fresh" TextFormat, and only set the bold
   parameter.  Then when you apply this, only the bold style will change.

3.  There appears to be a fontName property on the Font class.
   Does this not work?

Hugh


> Greetings,
>
> I am currently converting a flash game to iOS and have some troubles ( I
> already got the compile errors down to 84 from a few hundred caused by  
> UInt
> and some keyboard/mouse related code that wasn't relevant for iOS ).
>
>
> 1)
> "nme.text.Font does not have a constructor" What does this mean, is
> nme,text.Font not functional in NME ?Can I just remove the new Font line
> when not compiling into Flash with #if flash and will it still work ?
>
> 2)
> flash.text.TextField does not have .getTextFormat() which I use to then  
> set
> .font to my bold font
> so now I have this :
>
> //addboldness
> if (AddBold)
> {
> tfa = _tf.getTextFormat(); //This does not work
> tfa.font = boldFont;
>
> _tf.setTextFormat(tfa, boldStart, boldEnd); //I need tfa to make this  
> work
> }
> Is there another way I could bolden text under NME ?
>
> 3)
> nme.text.Font does not have have the field fontName which is required by  
> the
> version of Flixel/Haxe that I use, not sure if there is an alternative  
> means
> to get the fontName ?
>
> I am using the NME 3.0.1 from haxelib. Please let me know what other
> information I can provide to shed light on this.
>
> T.
>
> --
> View this message in context:  
> http://haxe.1354130.n2.nabble.com/On-NME-and-fonts-tp6815845p6815845.html
> Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

singmajesty
Fonts have been improved on SVN... it may mostly (or completely) resolve  
the issues you're dealing with.



Currently, on SVN, you could do this for all targets:



var font = Assets.getFont ("fonts/myfont.ttf");
var format = new TextFormat (font.fontName);

var text = new TextField ();
text.defaultTextFormat = format;
text.embedFonts = true;
text = "Hello!";
addChild (text);



(You could also do ApplicationMain.getAsset instead of Assets.getFont)






On Wed, 21 Sep 2011 07:44:44 -0700, Gamehaxe <[hidden email]> wrote:

> Hi,
> 1. Fonts on nme and flash are handled differently.  In flash, you  
> package them
> into an swf, and nme you use them as a file. So you going to need
>
> #if !flash
>     var font = new Font(filename);
> #else
>     // For flash, you can embed the font and it will "magically" appear
>     //  and you can just refer to it by name, or get a handle with:
>     flash.text.Font.enumerateFonts(...)
> #end
> You can use the nmml tool to handle these situations
>
> 2. getTextFormat has not been added yet.
>    I think you can create a "fresh" TextFormat, and only set the bold
>    parameter.  Then when you apply this, only the bold style will change.
>
> 3.  There appears to be a fontName property on the Font class.
>    Does this not work?
>
> Hugh
>
>
>> Greetings,
>>
>> I am currently converting a flash game to iOS and have some troubles ( I
>> already got the compile errors down to 84 from a few hundred caused by  
>> UInt
>> and some keyboard/mouse related code that wasn't relevant for iOS ).
>>
>>
>> 1)
>> "nme.text.Font does not have a constructor" What does this mean, is
>> nme,text.Font not functional in NME ?Can I just remove the new Font line
>> when not compiling into Flash with #if flash and will it still work ?
>>
>> 2)
>> flash.text.TextField does not have .getTextFormat() which I use to then  
>> set
>> .font to my bold font
>> so now I have this :
>>
>> //addboldness
>> if (AddBold)
>> {
>> tfa = _tf.getTextFormat(); //This does not work
>> tfa.font = boldFont;
>>
>> _tf.setTextFormat(tfa, boldStart, boldEnd); //I need tfa to make this  
>> work
>> }
>> Is there another way I could bolden text under NME ?
>>
>> 3)
>> nme.text.Font does not have have the field fontName which is required  
>> by the
>> version of Flixel/Haxe that I use, not sure if there is an alternative  
>> means
>> to get the fontName ?
>>
>> I am using the NME 3.0.1 from haxelib. Please let me know what other
>> information I can provide to shed light on this.
>>
>> T.
>>
>> --
>> View this message in context:  
>> http://haxe.1354130.n2.nabble.com/On-NME-and-fonts-tp6815845p6815845.html
>> Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Off for a bit

Gamehaxe
I'm off for a week or two - probably not answering emails.
(I don't think they have the internet in Sydney yet).
Look forward to 2000 emails when I get back.

Hugh

--
haXe - an open source web programming language
http://haxe.org
alx
Reply | Threaded
Open this post in threaded view
|

Re: Off for a bit

alx
Have a nice trip c:

On Thu, Sep 22, 2011 at 7:15 PM, Gamehaxe <[hidden email]> wrote:
I'm off for a week or two - probably not answering emails.
(I don't think they have the internet in Sydney yet).
Look forward to 2000 emails when I get back.

Hugh

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Off for a bit

Tony Polinelli
hah yup - its no perth ;P

On Fri, Sep 23, 2011 at 12:51 AM, alx <[hidden email]> wrote:
Have a nice trip c:


On Thu, Sep 22, 2011 at 7:15 PM, Gamehaxe <[hidden email]> wrote:
I'm off for a week or two - probably not answering emails.
(I don't think they have the internet in Sydney yet).
Look forward to 2000 emails when I get back.

Hugh

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

TjD__
In reply to this post by singmajesty
Greetings,

I have been trying to google this, but I cannot figure out how to use the svn NME.

I did try neko run.n but that gave me this :

bash-3.2$ neko run.n
Called from nme/display/Graphics.hx line 210
Called from nme/Loader.hx line 130
Called from C:\Motion-Twin\haxe/std/neko/Lib.hx line 33
Uncaught exception - load.c(352) : Primitive not found : /usr/lib/haxe/lib/nme/3,0,1//ndll/Mac/nme@nme_gfx_draw_triangles(-1)

Note that I run this on a Mac, not sure where the C:\ stuff comes from.

Can you provide me simple steps to compile from SVN ?

Cheers,
T.
Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

singmajesty
You shouldn't run "run.n" directly...

Use "haxelib dev nme /path/to/svn/checkout" to tell haxelib where you've  
put your dev directory.

Then call "haxelib run nme test YourProject.nmml cpp" like normal.


If it throws an error, saying that a primitive does not exist, that's a  
sign that you need to recompile the native NME C++ library for your  
platform. Sometimes things change under the hood which require a  
recompile. We don't have a build server setup to build for all the  
platforms and targets, so you might have to do it yourself sometimes.

Check out http://www.haxenme.org/developers/source for instructions on how  
to rebuild the library :)



On Fri, 23 Sep 2011 15:42:49 -0700, TjD__ <[hidden email]> wrote:

> Greetings,
>
> I have been trying to google this, but I cannot figure out how to use the
> svn NME.
>
> I did try neko run.n but that gave me this :
>
> bash-3.2$ neko run.n
> Called from nme/display/Graphics.hx line 210
> Called from nme/Loader.hx line 130
> Called from C:\Motion-Twin\haxe/std/neko/Lib.hx line 33
> Uncaught exception - load.c(352) : Primitive not found :
> /usr/lib/haxe/lib/nme/3,0,1//ndll/Mac/nme@nme_gfx_draw_triangles(-1)
>
> Note that I run this on a Mac, not sure where the C:\ stuff comes from.
>
> Can you provide me simple steps to compile from SVN ?
>
> Cheers,
> T.
>
> --
> View this message in context:  
> http://haxe.1354130.n2.nabble.com/On-NME-and-fonts-tp6815845p6825963.html
> Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

TjD__
singmajesty wrote
You shouldn't run "run.n" directly...

Use "haxelib dev nme /path/to/svn/checkout" to tell haxelib where you've  
put your dev directory.

Then call "haxelib run nme test YourProject.nmml cpp" like normal.


If it throws an error, saying that a primitive does not exist, that's a  
sign that you need to recompile the native NME C++ library for your  
platform. Sometimes things change under the hood which require a  
recompile. We don't have a build server setup to build for all the  
platforms and targets, so you might have to do it yourself sometimes.

Check out http://www.haxenme.org/developers/source for instructions on how  
to rebuild the library :)
Okay, first off, thanks for the patience with a newbie ;)

I'll tell you my saga of what I tried, please let me know what I did wrong, since it is not yet working ;\

First off, from that page I am not sure which to build for iOS, so I built these two :

haxelib run hxcpp Build.xml -Diphone -Diphoneos
haxelib run hxcpp Build.xml -Diphone -Diphonesim

Then of course I was missing the sdl-static folder, which I added, and it all seems to compile wonderfully with very few warnings ( reasonable stuff like unused variables etc.). It would be great if the build script could give a clear warning that I should check out the sdl-static folder for future newbies. Magic would be if the script could download the svn copy for you.

I also set the haxelib dev nme to my checked out svn.

And still I get pretty much the same error:

Tom-Demuyts-Mac-mini:ios hellband$ ./update
Called from nme/display/Graphics.hx line 210
Called from nme/Loader.hx line 130
Called from C:\Motion-Twin\haxe/std/neko/Lib.hx line 33
Uncaught exception - load.c(352) : Primitive not found : /Users/hellband/desktop/dropbox/haxe/nme//ndll/Mac/nme@nme_gfx_draw_triangles(-1)

I realized from the last line that it points to the svn folders, but looks at the mac folders, so I probably needed a Mac compile.

at that point, I tried

haxelib run hxcpp Build.xml

Which failed because I was missing c++config.h somehow

/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:64:28: error: bits/c++config.h: No such file or directory

I found 3 bits folder, and I added a symlink in the Include directory to the sdk10.5/x86_64 folder which seems to fix that problem.

Then, in the end, I end up with this :

Undefined symbols for architecture i386:
  "_fopen$UNIX2003", referenced from:
      _FT_Stream_Open in libfreetype.a(ftsystem.o)
      _Curl_cookie_output in libcurl.a(cookie.o)
      _Curl_cookie_init in libcurl.a(cookie.o)
      _readfromfile in libcurl.a(formdata.o)
      _Curl_getformdata in libcurl.a(formdata.o)
      _Curl_parsenetrc in libcurl.a(netrc.o)
      _file_do in libcurl.a(file.o)
      ...

Which apparently happens after using different version of libraries, I am really stuck at this point ;\

Please let me know what else/different I can do.

T.
Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

jujulian1987
Getting exactly the same error which wasn't there before when updating nekonme and hxcpp to the newest version using svn. So it might not be your fault?

Called from nme/display/Graphics.hx line 210 
Called from nme/Loader.hx line 130 
Called from C:\Motion-Twin\haxe/std/neko/Lib.hx line 33 
Uncaught exception - load.c(352) : Primitive not found : /Users/hellband/desktop/dropbox/haxe/nme//ndll/Mac/nme@nme_gfx_draw_triangles(-1) 

Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

jujulian1987
Checked this error with different OS. On Windows the error doesn't occur with exact the same revision of nme, hxcpp and the project I'm trying to compile to. With Snow Leopard 10.6.8 however the error is always there. No metter what I'm trying to compile as long as nme is envolved.

jujulian1987 wrote
Getting exactly the same error which wasn't there before when updating nekonme and hxcpp to the newest version using svn. So it might not be your fault?

Called from nme/display/Graphics.hx line 210 
Called from nme/Loader.hx line 130 
Called from C:\Motion-Twin\haxe/std/neko/Lib.hx line 33 
Uncaught exception - load.c(352) : Primitive not found : /Users/hellband/desktop/dropbox/haxe/nme//ndll/Mac/nme@nme_gfx_draw_triangles(-1) 
Reply | Threaded
Open this post in threaded view
|

Re: On NME and fonts

TjD__
jujulian1987 wrote
Checked this error with different OS. On Windows the error doesn't occur with exact the same revision of nme, hxcpp and the project I'm trying to compile to. With Snow Leopard 10.6.8 however the error is always there. No metter what I'm trying to compile as long as nme is envolved.

jujulian1987 wrote
Getting exactly the same error which wasn't there before when updating nekonme and hxcpp to the newest version using svn. So it might not be your fault?

Called from nme/display/Graphics.hx line 210 
Called from nme/Loader.hx line 130 
Called from C:\Motion-Twin\haxe/std/neko/Lib.hx line 33 
Uncaught exception - load.c(352) : Primitive not found : /Users/hellband/desktop/dropbox/haxe/nme//ndll/Mac/nme@nme_gfx_draw_triangles(-1) 
The thing is that I want to build for iOS, so Windows is out of the option ;\
This is really too bad, I was all excited by NME, but seems that until someone compiles the binaries for Lion, this will not happen.

T.