Storing ttf font in a binary

sorry i’m going off on my get everything possible into the binary trip
again, this time i’m wondering how best to hold a ttf font, can someone
point me to a guide / guide me on how to do it

to do images right now i either use an xpm in a header file or bin to hex
png’s into a header file then sdlrwops them back again with sdl image, would
it be possible to use a similar proccess with the fonts, i.e. binto hex the
font.ttf file, then rwops or similar that into a font using the sdl ttf
functions?

no comments why would you want the font in the binary, i want it, makes life
easier for the end user, crap i’m gonna get in trouble for starting another
flame war now i said that arnt i :wink:

sorry i’m going off on my get everything possible into the binary trip
again, this time i’m wondering how best to hold a ttf font, can someone
point me to a guide / guide me on how to do it

to do images right now i either use an xpm in a header file or bin to hex
png’s into a header file then sdlrwops them back again with sdl image, would
it be possible to use a similar proccess with the fonts, i.e. binto hex the
font.ttf file, then rwops or similar that into a font using the sdl ttf
functions?

That is exactly how I do it. Use bin2h on the file, then open the array
with TTF_OpenFontRW and SDL_RWFromConstMem

GregoryOn Thu, 19 Mar 2009, Neil White wrote:

2009/3/19 Gregory Smith > On Thu, 19 Mar 2009, Neil White wrote:

sorry i’m going off on my get everything possible into the binary trip

again, this time i’m wondering how best to hold a ttf font, can someone
point me to a guide / guide me on how to do it

to do images right now i either use an xpm in a header file or bin to hex
png’s into a header file then sdlrwops them back again with sdl image,
would
it be possible to use a similar proccess with the fonts, i.e. binto hex
the
font.ttf file, then rwops or similar that into a font using the sdl ttf
functions?

That is exactly how I do it. Use bin2h on the file, then open the array
with TTF_OpenFontRW and SDL_RWFromConstMem

thanks, just me being lazy again, i wasn’t sure if there was such a function
avalable with sdlttf or not :wink:

2009/3/19 Neil White :

sorry i’m going off on my get everything possible into the binary trip
again

You’re just making it harder for users to customize and debug your product.–
http://codebad.com/

You’re just making it harder for users to customize and debug your product.

if everything is in one file (aside from the actual SDL.dll, for windows at
least, then i can just have a link to it and thats it, its all just a file,
i still have yet to release anything in this form, but when i actually
finish something, for windows spods at least it would make a change to have
a program that is simple to download and use, instead of all this install
uninstall unzip bullsheep.

anyway, now you are the ne trying to make trouble :wink:

why the heck does everything windows have to come in some zip disguised as
an exe anyway, why not just make the whole thing run from one exe, then if
you dont have install rights or whatever you an just run it.

Donny Viszneki wrote:

You’re just making it harder for users to customize and debug your product.

Hi,

I hate for my first post to be in disagreement, but sometimes that
happens. :slight_smile:

I use SDL for developing on the PlayStation Portable (Sabacc Basics).
This platform is not so great on feedback depending on which firmware a
given app is built for. Until I started compiling for newer kernels,
output to stdout/stderr was not redirected properly by SDL or any other
form, so there was no way to get feedback on missing files or other errors.

The solution was to build resources into the application. Sure, it has
the drawback you mention. However, if the application is small enough
there is no need to worry that the end user did not put the files where
the application expects them, because they’re built in. If the app
crashes, I know at least its unlikely due to a missing file, because all
the user has to do is copy one file.

To the OP I have found that most SDL_* libraries allow you to do this
via *RW functions. There are a few that made no mention of it in the
documentation, but if you search the headers for a simple RW you usually
find what you’re looking for.–
Anthony T.
1990 Trans Am LB9 4L60
Only two things are infinite, the universe and human stupidity, and I’m not sure about the former. – Albert Einstein

Hiyya, what the hell ur both crazy. no j/k. I myself like the user to either have access to the font file in an orderly program folder fashion or simply put any fonts in the sys folder like most coders seem to do. Then most programs will be able to use them and you have many choices of existing fonts the user can choose from there too. To each coder his own method though-------------------------------------

.
---- Donny Viszneki <donny.viszneki at gmail.com> wrote:

=============
2009/3/19 Neil White :

sorry i’m going off on my get everything possible into the binary trip
again

You’re just making it harder for users to customize and debug your product.


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello !

sorry i’m going off on my get everything possible into the binary trip
again

You’re just making it harder for users to customize and debug your product.

Not necesarily. On Windows and Mac OS (X) you can count on that several fonts
are installed by default on the system. On Linux you cannot. When you ship your
app with some fonts, you have a backup possibility. You can let the user choose
the fonts, but at least have a backup.

CU

heh i knew i’d make trouble :wink:

well imho, most people that are gonna use any crap i make are probably not
gonna be on mutilple user machines, and even if they are, for linux the file
can just sit in a pathed bin directory and as the files would be incredibly
small then it would save the bother of having dat files lying around the
place, and i dont want users to be able to change the font or mess up the
gfx, messed up gfx in my case means messed up engine.

as for treating users like dummies, well, id say most are anyway, including
me :wink: and id say forcing users to use installers all the time is more
treating them like dummies (hides)

(Sorry if this goes through twice, I sent yesterday, but maybe through
the wrong account in my mail reader…)

Donny Viszneki wrote:

You’re just making it harder for users to customize and debug your product.

Hi,

I hate for my first post to be in disagreement, but sometimes that
happens. :slight_smile:

I use SDL for developing on the PlayStation Portable (Sabacc Basics).
This platform is not so great on feedback depending on which firmware a
given app is built for. Until I started compiling for newer kernels,
output to stdout/stderr was not redirected properly by SDL or any other
form, so there was no way to get feedback on missing files or other errors.

The solution was to build resources into the application. Sure, it has
the drawback you mention. However, if the application is small enough
there is no need to worry that the end user did not put the files where
the application expects them, because they’re built in. If the app
crashes, I know at least its unlikely due to a missing file, because all
the user has to do is copy one file.

To the OP I have found that most SDL_* libraries allow you to do this
via *RW functions. There are a few that made no mention of it in the
documentation, but if you search the headers for a simple RW you usually
find what you’re looking for.–
Anthony T.
1990 Trans Am LB9 4L60
Only two things are infinite, the universe and human stupidity, and I’m not sure about the former. – Albert Einstein

2009/3/19 Neil White :

sorry i’m going off on my get everything possible into the binary trip
again

You’re just making it harder for users to customize and debug your product.
Hello !

Not necesarily. On Windows and Mac OS (X) you can count on that several
fonts
are installed by default on the system. On Linux you cannot.

“Linux” is not an operating system franchise, it’s a kernel, just one
part of a system. You might as well have said “On Intel CPUs you
cannot depend on which fonts you will have access to.”

When you ship your
app with some fonts, you have a backup possibility. You can let the user
choose the fonts, but at least have a backup.

I don’t think anyone was suggesting that you shouldn’t include fonts
with your application!

o_O

2009/3/20 Neil White :

it would save the bother of having dat files lying around the
place

I’m not sure what you mean by “lying around the place,” as most
software knows exactly where its data files are, and your package
manager / makefile / installer script know exactly where to install
and uninstall its files.

and i dont want users to be able to change the font or mess up the
gfx, messed up gfx in my case means messed up engine.

How considerate of you. Have you ever heard of FOSS (free open source
software) before? It’s this totally awesome idea that you can use your
software however you feel like it, and no one has the right to stop
you. You should check it out.

as for treating users like dummies, well, id say most are anyway, including
me :wink:

I guess that depends on what kind of people like your software.

and id say forcing users to use installers all the time is more
treating them like dummies (hides)

Nope! :slight_smile:

I use SDL for developing on the PlayStation Portable (Sabacc Basics).

There are exceptions to every rule. I wouldn’t dream to equate a
typical personal computer with a PSP.

This
platform is not so great on feedback depending on which firmware a given app
is built for. Until I started compiling for newer kernels, output to
stdout/stderr was not redirected properly by SDL or any other form, so there
was no way to get feedback on missing files or other errors.

It sounds like you only need to build in enough resources to
facilitate error feedback. For all my ranting against building your
resources into your binaries, I personally usually include a single
raster font (and an interactive console, usually OGLCONSOLE or
SDL_console) with which I can report errors to the user. As I figure
things, most people don’t know how to run my applications from the
command line, and wouldn’t get see what comes out on regular stdout
and stderr. SDL on Windows used to redirect those to files, but that’s
kind of dangerous since stdout/stderr might output A LOT of data, and
then you’d have huge files and potentially use up all your user’s disk
space, which can be particularly bad on Windows systems which have
their virtual memory on the same partition as all their other files.

The solution was to build resources into the application. Sure, it has the
drawback you mention. However, if the application is small enough there is
no need to worry that the end user did not put the files where the
application expects them, because they’re built in. If the app crashes, I
know at least its unlikely due to a missing file, because all the user has
to do is copy one file.

It’s quite amazing to me how hard it can be for some people to find
files in the same directory as your application (or anywhere else you
choose to put them.) When I was particularly concerned with this
problem, I had my applications check multiple locations, beginning
with the current working directory, then of likely preset locations
like /usr/share/whatever, then trying to deduce the location of the
application binary from argv[0].

There are some situations where it’s appropriate to do what you do,
and I think PSP might be one of them. I don’t agree at all with Neil
White, however.On Thu, Mar 19, 2009 at 9:12 PM, Torsten Giebl wrote:

On Thu, Mar 19, 2009 at 10:54 AM, Donny Viszneki <@Donny_Viszneki> wrote:
On Fri, Mar 20, 2009 at 9:10 AM, Anthony T. wrote:


http://codebad.com/

2009/3/19 Neil White :

sorry i’m going off on my get everything possible into the binary trip
again

You’re just making it harder for users to customize and debug your product.

Riiiight. Next time you write a game, try randomly “customizing” one
of the fonts
and see how good it looks. Plus, the very few users willing, able and worthy
of debugging your product are more than capable of debugging the binary.

Think of it as a way of keeping out riff-raff.

RF> From: Donny Viszneki <donny.viszneki at gmail.com>

2009/3/19 Neil White :

sorry i’m going off on my get everything possible into the binary trip
again

You’re just making it harder for users to customize and debug your product.
Hello !

Not necesarily. On Windows and Mac OS (X) you can count on that several
fonts
are installed by default on the system. On Linux you cannot.

“Linux” is not an operating system franchise, it’s a kernel, just one
part of a system. You might as well have said “On Intel CPUs you
cannot depend on which fonts you will have access to.”

Excellent point. Mr Giebl should have used the term “GNU/Linux” to refer
to the world’s only not-for-profit operating system without bundled fonts.

2009/3/20 Neil White :

it would save the bother of having dat files lying around the
place

[…]

and i dont want users to be able to change the font or mess up the
gfx, messed up gfx in my case means messed up engine.

How considerate of you. Have you ever heard of FOSS (free open source
software) before? It’s this totally awesome idea that you can use your
software however you feel like it, and no one has the right to stop
you. You should check it out.

It sounds WONDERFUL. Niel, if you use FOSS, you’ll have unlimited freedom,
so you’ll finally be able to stick that font in your binary.

RF> From: Donny Viszneki <donny.viszneki at gmail.com>

On Thu, Mar 19, 2009 at 9:12 PM, Torsten Giebl wrote:

On Thu, Mar 19, 2009 at 10:54 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

Not necesarily. On Windows and Mac OS (X) you can count on that several
fonts
are installed by default on the system. On Linux you cannot.

“Linux” is not an operating system franchise, it’s a kernel, just one
part of a system. You might as well have said “On Intel CPUs you
cannot depend on which fonts you will have access to.”

Excellent point. Mr Giebl should have used the term “GNU/Linux” to refer
to the world’s only not-for-profit operating system without bundled fonts.

You’re missing the point. The comparison between “what fonts you can
expect to find on Win32 systems” and “what fonts you can expect to
find on Linux systems” is faulty, even if you add GNU; a much more
appropriate comparison would be with a specific distribution or group
of distributions from the same vendor or something (like “what fonts
can you assume will be available on Red Hat GNU/Linux systems?”)On Tue, Mar 24, 2009 at 3:46 PM, Rhythmic Fistman wrote:

From: Donny Viszneki <@Donny_Viszneki>
On Thu, Mar 19, 2009 at 9:12 PM, Torsten Giebl wrote:


http://codebad.com/

Don’t feed the trolls, Donny…

Riiiight. Next time you write a game, try randomly “customizing” one
of the fonts and see how good it looks.

What a good argument. It might be difficult, so make it more difficult.

You have obviously never “customized” a crappy font before.

Plus, the very few users willing, able and worthy
of debugging your product are more than capable of debugging the binary.

Think of it as a way of keeping out riff-raff.

You know, you’re right. Only certain people are really responsible
enough to customize my software. I think I’m going to start a new
"open source" movement with background checks and NDAs to make sure
I’m only sharing the ability to change my software with fine
upstanding citizens such as yourself.On Tue, Mar 24, 2009 at 3:19 PM, Rhythmic Fistman wrote:

From: Donny Viszneki <@Donny_Viszneki>


http://codebad.com/

2009/3/24 Mason Wheeler :

Don’t feed the trolls, Donny…

It’s hard to resist… we have too much in common…

feels shame
http://codebad.com/