Embed font from macros (flash target)

228 views
Skip to first unread message

Dima Granetchi

unread,
May 19, 2013, 6:20:42 AM5/19/13
to haxe...@googlegroups.com
I trying embed bitmapData and font same as here embed sounds


BitmapData embeds correct, but font write

src/../assets/arial.ttf:1: character 0 : File not found

Maximiliano Fernández

unread,
May 19, 2013, 10:28:48 PM5/19/13
to haxe...@googlegroups.com
Hi

There are less-painful methods for embedding fonts and sound, using compiler metadata (@:font and @:sound). In the following link you can learn something more about the metadata and how to use them: http://haxe.org/manual/tips_and_tricks#flash-specific-metadata

I hope this helps you ;)

Maximiliano Fernández do Santos

0 1 0              0 1 0
0 0 1  Rammserker  1 0 0
1 1 1              1 1 1


--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dima Granetchi

unread,
May 20, 2013, 5:43:34 PM5/20/13
to haxe...@googlegroups.com
No. it's not help.

I use meta like @:sound from Nicolas macros for embed bitmaps and fonts in macros. Bitmaps and sounds works correct, but fonts not.

Simon Krajewski

unread,
May 20, 2013, 5:49:19 PM5/20/13
to haxe...@googlegroups.com
Am 20.05.2013 23:43, schrieb Dima Granetchi:
> No. it's not help.
>
> I use meta like @:sound from Nicolas macros for embed bitmaps and
> fonts in macros. Bitmaps and sounds works correct, but fonts not.

I didn't even know about that data: trick, is that documented somewhere?

Simon

Dima Granetchi

unread,
May 20, 2013, 5:56:17 PM5/20/13
to haxe...@googlegroups.com
I found this trick in Nicolas source code from ld25 https://github.com/ncannasse/ld25/blob/master/lib/Sounds.hx




--- You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.

Maximiliano Fernández

unread,
May 21, 2013, 2:33:28 AM5/21/13
to haxe...@googlegroups.com
Dima: In Nicolas's "Ludum Dare 25" entry, the font is loaded from a SWF lib (Look at the "obj" directory, there is "ld25Resources.swf" file, containing the "PixelFont" used in the entry), not from the font found in "gfx" directory. He isn't using any macros for loading the font, only the -swf-lib compiler argument and the "h2d.Font" class.

Simon: Don't know if you are talking about the metadata for embeding resources in a swf, but here you may find information about them: http://haxe.org/manual/tips_and_tricks#flash-specific-metadata. Perhaps you refer to  something else.

Hope this helps

Maximiliano Fernández do Santos

0 1 0              0 1 0
0 0 1  Rammserker  1 0 0
1 1 1              1 1 1


You received this message because you are subscribed to the Google Groups "Haxe" group.

Dima Granetchi

unread,
May 21, 2013, 3:07:45 AM5/21/13
to haxe...@googlegroups.com
RammserkerMy main question: Why this trick works only with bitmaps and sounds? For what this trick exist?

Simon,
Today I replaced "data:" + fileCont with simle filePath and fonts started works with sounds and bitmaps. Very strange why exist data: trick when all works with out it.

Simon Krajewski

unread,
May 21, 2013, 3:10:57 AM5/21/13
to haxe...@googlegroups.com
Am 21.05.2013 09:07, schrieb Dima Granetchi:
RammserkerMy main question: Why this trick works only with bitmaps and sounds? For what this trick exist?

Well that's easy to answer: I didn't know about it and didn't implement it when adding @:font. ;)


Simon,
Today I replaced "data:" + fileCont with simle filePath and fonts started works with sounds and bitmaps. Very strange why exist data: trick when all works with out it.

From looking at the code, data: allows you to pass the file contents directly instead of the file name. I suppose this can be useful if you are loading a file in a macro and maybe even modify it there.

Simon

Maximiliano Fernández

unread,
May 21, 2013, 3:24:24 AM5/21/13
to haxe...@googlegroups.com
Now I understand your question. Sorry for not understanding earlier. Don't know why.

Maximiliano Fernández do Santos

0 1 0              0 1 0
0 0 1  Rammserker  1 0 0
1 1 1              1 1 1


--

Dima Granetchi

unread,
May 21, 2013, 3:25:43 AM5/21/13
to haxe...@googlegroups.com

On 21 May 2013 10:10, Simon Krajewski <si...@haxe.org> wrote:
From looking at the code, data: allows you to pass the file contents directly instead of the file name. I suppose this can be useful if you are loading a file in a macro and maybe even modify it there.

Maybe you right. I removed data: trick and now all works correct. I can write my fourth article about macros.

Simon Krajewski

unread,
May 21, 2013, 3:31:31 AM5/21/13
to haxe...@googlegroups.com
Out of curiosity, where can one find your articles?

Simon

Dima Granetchi

unread,
May 21, 2013, 3:34:07 AM5/21/13
to haxe...@googlegroups.com

On 21 May 2013 10:31, Simon Krajewski <si...@haxe.org> wrote:
Out of curiosity, where can one find your articles?

My articles is here http://haxe.ru/blog/8713 all sources (more usefull for you) here https://github.com/profelis/macros_lessons (comments and fixes are welcome)

Alexander Kuzmenko

unread,
May 21, 2013, 4:56:26 AM5/21/13
to haxe...@googlegroups.com
Well, you forgot to mention, it's in russian only :)

вторник, 21 мая 2013 г., 11:34:07 UTC+4 пользователь Dima Granetchi написал:

Alexander Kuzmenko

unread,
May 21, 2013, 4:59:00 AM5/21/13
to haxe...@googlegroups.com
Perhaps, we can translate it if someone can take care to review and correct for proper english :)

вторник, 21 мая 2013 г., 12:56:26 UTC+4 пользователь Alexander Kuzmenko написал:
Reply all
Reply to author
Forward
0 new messages