Rockbox Technical Forums

Support and General Use => Theming and Appearance Customization => Topic started by: iwantanimac on February 21, 2007, 06:32:27 AM

Title: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 21, 2007, 06:32:27 AM
ROCKbox Font Convertor
BYO fonts for the Open Source Jukebox Firmware.

..:: DETAILS, LINKS AND UPDATES NOW ON THE ROCKBOX WIKI ::..
http://www.rockbox.org/twiki/bin/view/Main/RockboxFontConvertor

After reading the thread about converting fonts in this post (http://forums.rockbox.org/www.misticriver.net/showthread.php?t=33835), i decided to code a batch file to do the work for me. This is the result, the Rockbox font convertor. It ain't in any way pretty, as it's all in command prompt, but it does the job and does it well and pretty damn fast, too.
 
More information and a slightly more technical discussion of this can be found at the MisticRiver Forums, [Here]
 (http://www.misticriver.net/showthread.php?p=511225)

The Wiki page contains all the links and details you should need. See it [Here] (http://www.rockbox.org/twiki/bin/view/Main/RockboxFontConvertor)
 
Cheers Guys,
iwantanimac
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 21, 2007, 11:15:59 AM
Quote
allow font size to be set from command line -OR- default to standard setting in batch file. (Very Soon - Need help implementing this in a batch file)

Done. Attached version of batch file allows fontsize setting using parameter 2:
Code: [Select]
makefont [Fontfile] [Fontsize]
Quote
Errors if the font filename has a space. (eg. Lucida Grande.ttf) - tries to find both "Lucida" and "Grande.ttf" solved by renaming the file.

Done. Attached version of batch file detects and allows up to one space in the font name:
Code: [Select]
makefont Lucidia Grande.ttf - This is OK
makefont Lucidia Grande Bold.ttf - This will still NOT work

Font size feature from above change also included
Code: [Select]
makefont Lucidia Grande.ttf 14 - This will work OK



[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: ryran on February 21, 2007, 03:52:57 PM
nice job bascule.
ps to Geoff: check the code for your mirror links.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 22, 2007, 03:10:58 AM
Wow, thanks! That's brilliant.

Now i have to update my posts =P

And about the links: I thought the http was conflicting before, but it seems it wasn't =/ Fixing now...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: Flid on February 22, 2007, 08:40:41 AM
Cheers Geoff & Bascule. Nice little DOS utility.
However, I can't get the font height switches to work? It always reverts to it's default 8 point . Guidance appreciated, thanks.

Edit:-
Ok... sussed it.  I read the wiki and discovered that I had to directly manipulate/edit the .bat file. I now have makefont10.bat, makefont12, makefont14 etc.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: ryran on February 22, 2007, 12:25:02 PM
uhmm.. Flid, that was the main point behind Bascule's edit. Get the second one he attached and replace makefont.bat from Geoff's zip with it--then syntax is "makefont arial.ttf 12"  ... with the size being last.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: Flid on February 22, 2007, 01:15:38 PM
Well... that's exactly what I expected, but I misread Geoff's comment about updating his links. I assumed incorrectly that he had already updated them, re-downloaded the same files and had the same problems. Fiddling with the .bat file was interesting none the less though. Thanks.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: soap on February 22, 2007, 09:39:21 PM
Looks nice, this really should be moved to the wiki.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: ryran on February 23, 2007, 01:48:37 AM
It's already in there (a link to the misticriver thread).
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 23, 2007, 04:23:52 AM
Sorry guys I'm in the middle of updating it. I might make my own Wiki page later. I've been too busy with schoolwork to update everything.

I really appreciate the positive feedback though. I should've posted this t the rockbox forums long ago XD

But umm... working on getting a default fontsize setting (In case it's unchecked) and getting the multi-word font name working together nicely. And a help more with makefont ?. Should all be in the next release sometime within the next.... 48 hours. Stay tuned!

EDIT: 1.1 Beta is out (See the tiny text next to current version). Please test it (Because i can't right now...) - it's the one i packaged last night, so it's untested (Apart from trying a few different combinations and checking all the variables...) so please post any results when you can!

For more info on using the new version, navigate to the folder as usual and type;

Quote from: Command Prompt
makefont ?
or
Quote from: Command Prompt
makefont help

and it will give you some info on how to use it.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 23, 2007, 08:40:37 AM
This case does not work in the 1.1 Beta:

Code: [Select]
makefont comic bold.ttf
because it's missing the font size (which is now allowed), but my code used it's presence to determine if it was a spaced name or not.

I'm working on it...

EDIT: I've stopped working on it for now :(
For the life of me, I cannot get the FOR... command to do what I want and any other solution will be clunky and very inelegant.
I may just knock together that solution, but it won't be till next week now...

All other cases and the Help/About functionality work fine. :)
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 24, 2007, 05:27:17 AM
That's fine. ill have a look at it ASAP (Probably tomorrow) and see what i can do.

Otherwise i might just use the Choice command - can you set a timeout on that? If so ill just use that.

Clunky? sure but for now it should be ok - just until we figure something more useful out.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 24, 2007, 01:47:24 PM
Well, it's done...

I'm not very happy, because it's double the size, but it does now cope with up to 8 arguments on the command line (e.g., makefont comic special broad font.ttf 12) with automatic detection of whether a font size has been specified as the last argument (and defaulting to 8pt if it has not).

As for the CHOICE command, it seems to be a separate executable (for Win2000 at least), so I have not looked further at that option.

[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: JustJohnny on February 24, 2007, 02:07:03 PM
Hi.

Below is code for a patch that will:
It basically concatentates all command line arguments into the file name, except for the last one, which it then checks to see if it is an integer or empty to determine the font size.

Currently can't handle titles with multiple spaces between words. I've only tested the patch code (on WindowsXP), and haven't actually converted any fonts with the complete batch file.

Hope this helps,

JJ

----- edit: merged code into attached file --------

[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 24, 2007, 08:17:02 PM
thanks for the input, guys. ill have a look at this later, and see what works best.

@JustJohnny: could your code be implemented in the new beta version? where exactly would it go?

can't fiddle now, on my psp, and about to leave for lunch.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 25, 2007, 04:23:34 PM
Well, JustJohnny, that's certainly more elegant than mine. I've never used SHIFT before, but reading up on it I see how it works.

Neat!

I think I'll leave it for the OP to decide...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: JustJohnny on February 25, 2007, 09:11:42 PM
Hi Bascule,

Yes, shift worked out well. I wanted  to use some type of while loop to go through the list of the arguments, but didn't find any convenient way to do this. Found the shift command after googling for "windows+batch+reference" and realized I could make my own while loop with the shift and the goto command. The hardest part was finding a way to check if the last thing the FONTSIZE was set to was an integer.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 26, 2007, 04:48:28 AM
The hardest part was finding a way to check if the last thing the FONTSIZE was set to was an integer.

So how did you do it?

I don't understand (and can't find on the intarweb) what the "+" (plus) sign means in these lines:
Quote
IF %FONTSIZE% NEQ +%FONTSIZE% (SET FONTFILE=%FONTFILE% %FONTSIZE%)
IF %FONTSIZE% NEQ +%FONTSIZE% (SET FONTSIZE=%DEFAULTFONTSIZE%)

For my batch file, I used:

Quote
if %2 LEQ a (goto 2-CaseSizeSet) else (goto 2-CaseNoSize)

which returns TRUE if %2 is a numeric value, because all numbers are mathematically less than the alphabetic character 'a'.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 26, 2007, 09:33:21 AM
OK, well here we go!

Taking the simplicity of JustJohnny's use of shift and changing the syntax back-to-front to:

makefont [fontsize] filename

in order to make the initial assessment of whether the fontsize option has been included or not, I've elegantly (IMHO) reduced the batch file to something I'm happy with (attached).

Unfortunately, whilst looking for how to write the syntax correctly I found/re-discovered/remembered that the simple answer all along to the whole problem would have been to do this:

makefont "a really long font name.ttf" 14

and it would always appear as only two parameters %1 and %2.

D'oh!

[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: JustJohnny on February 26, 2007, 09:53:08 AM
OK, well here we go!

Taking the simplicity of JustJohnny's use of shift and changing the syntax back-to-front to:

makefont [fontsize] filename

in order to make the initial assessment of whether the fontsize option has been included or not, I've elegantly (IMHO) reduced the batch file to something I'm happy with (attached).


Bascule, I see your batch foo is stronger than mine, and using the traditional kung-fu action movie trick of using my powers against me have come up with a truly beautiful solution--even giving the command structure a more typical usage pattern:  Command [options] < object of the command >.

I bow before your most elegant solution  :)

I wonder if this takes care of any "drag and drop" problems?

Also I liked in your previous version how you pointed out where to change the default font size.  Perhaps adding a note in your rem statement about that, or creating a DEFAULTFONTSIZE variable which is declared at the top for easy access.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 26, 2007, 12:08:03 PM
I'm really not sure about how drag 'n' drop works with batch files and I don't see how the fontsize parameter would be passed in...

I'm happy with how it is, now.

@ iwantanimac: Are you planning on going for a release with any of these suggestions?
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: ryran on February 26, 2007, 01:25:45 PM
Hah. Nice work you two.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 27, 2007, 05:29:36 AM
Lol, i'm looking at the code that's been posted and there's some pretty complicated stuff going on. When i finish my homework i'll give it a look.

May the most elegant and simple soluton win! :D

Oh, and if drag 'n' drop can work - even better! Would make it easier for noobs less talented people :P.

EDIT: Okay i'm looking at all the solutions now. Finally have time!

EDIT2: Sorry, JustJohnny, but Bascule wins. I like his solution better... It truly is more elegant and simple. Just gotta hack in a few more bits 'n pieces (And get 7-Zip on this PC) before i can update everything.

EDIT3: Okay i'm testing now... Works with filenames up to 10 words with sizing... Works with one word filenames without sizing...

EDIT4: Aha! Found a problem! If your filename has a number as the first word. Stupid, probably not going to happen, but it might. Oh well. The rest works perfectly, so release cominatcha pretty much.... now.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 27, 2007, 08:17:05 AM
UPDATES!!!  ;D

Okay, 1.1 is out. I've thoroughly tested it and the only thing i can find wrong with it is that if the filename includes a number as the first word (Probalby doesn't even exist normally) then it thinks that's the size. It also did something weird when i did that with a font size.

Other than that it's the best version yet. And i updated the comments to be more obvious when you're not running Notepad++.  :D

Anyway, have a look, and as usual i need mirrors, and will need people to update their mirrors, too.

Cheers guys,
iwantanimac
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 27, 2007, 09:09:21 AM
Right, using my newly researched batch knowledge, I've got a drag-and-drop version ready ;D

Drag one or multiple font files onto this batch file and it will request the required font size then loop through the fonts converting them.

If you type 'help' at the font prompt, it will jump to the help section
@ iwantanimac: I have NOT updated the actual help text, so you will have to do that :P

The only current restriction is that the .ttf/.otf file must be in the same directory as the batch file when it is dragged and dropped in order to make sure that the AppPath variable is valid.
I would really like to able to drop a font file from anywhere on the PC (network?) to the batch file (similarly located anywhere) and for it to always work.
This could probably be fixed by having separate variables for the font path and the batch application path, but that will have to be later...

Reply here or PM me if you need any further explanation...

...I really must spend less time on this... ;)

[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: ryran on February 27, 2007, 06:26:33 PM
Sorry for your free time wasted away, but bascule, that's pretty impressive. :D

Geoff: as I told you a couple weeks ago by email, I'd be happy to host.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 28, 2007, 03:32:03 AM
Yeah, stop updating!  :o

It makes it a pain to have to update everything!  ;)

Umm... I'm kinda happy with the way it is right now... and i think ill just focus on getting some other more important things working... linke maybe figuring out how to get fonts to look a bit better (There MUST be a way)

Drag 'n' drop is nice... Is it optional? Can i still use it in the same way as before? I understand if it had to change (Again) but i'd prefer to keep it simple.

Some people have said they supported the idea of a GUI. I ain't great at any programming language other than VB, but i want to give C a try... so i'm getting Dev-C++ later along with wxWidgets - is ther much point? Can i have a GUI without wxWidgets - I only looked cause i'd heard of it before (And i'm hoping it's nice and streamlined and fast unlike VB.NET)

The GUI version would (In theory) instead of running separate processes (Like it does now) simply have all the binaries combined into the one program. Maye it could even be set up so that it's GUI by default (Double-Click or Drag/Drop) and if you type an argument like -c or something, it does it command line, faster and more techy oriented.

Dunno how i'll go but seeing how all the binaries used are open source and available, i might as well see what i can do. If anyone knows anything about C programming, that'd be awesome, too.

As for the current version.. it stays. I just got my mirrors to update, so i don't want to put out another update the next day, but i will look at this and maybe in the next version.

I'm wondering also if anyone feels it's worth prettying the app up any more than i have... I'd change the background and foreground colours and the title - 2 lines of code AFAIK - not huge, but i'm just wondering... Please post your thoughts!
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 28, 2007, 05:06:55 AM
Drag 'n' drop is nice... Is it optional?
Yes it is optional, provided that the new input format is observed if using the command prompt:

makefont filename [filename2 filename3 ...]

Filenames with spaces need to be enclosed in quotes.

E.g. makefont comic.ttf  "comic bold.ttf"

Alternatively, you can drag and drop multiple files onto the batch file and they will all be converted to the requested font size.

Fonts must be in the same folder as the batch file. This seems too complicated to fix ATM, so I am not going to try.

For this revision I focused on the drag and drop ability, as you seemed very keen on it. I see this now as a finished product that anyone could use:
Copy from the system fonts folder on your PC or download some fonts from the internet to the Make Font folder, drag and drop them onto the batch file, enter the required font size or just press return for the default 8pt and bingo! a bunch of fonts ready to be copied across to your Rockboxed player.

Some people have said they supported the idea of a GUI. ...is there much point?
I don't think so, unless you want the experience of writing an app for your own benefit ;)

As for the current version.. it stays. I just got my mirrors to update, so i don't want to put out another update the next day, but i will look at this and maybe in the next version.
This version also fixes the problem you found with font names starting with a number; in fact it pretty much resolves everything except the anti-aliasing problem...
Like I said above, for me this is a finished version (apart from the help text ;) ) that I am happy with and am not planning to update further.

I'm wondering also if anyone feels it's worth prettying the app up any more than i have... I'd change the background and foreground colours and the title - 2 lines of code AFAIK - not huge, but i'm just wondering... Please post your thoughts!
This would be sufficient AFAIAC. Just enough to differentiate it from other scripts people may run, but without the fuss of a GUI.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 28, 2007, 06:13:00 AM
Okay... so to use your newer version, you can go

makefont 12 Lucida Grande.ttf

or

makefont Lucida Grande.ttf

as well as

makefont 12 "Lucida Grande.ttf" "Arial Black.ttf" "Square721 BT.ttf"

And it would still work the same (Apart from the font sizing as 8 on the second, and it converting three fonts on the last?)

Or does it prompt for font size no matter what?  - if it does that there should just be a timeout...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 28, 2007, 06:40:59 AM
No. You have to use quotes if there are spaces in the name and you cannot pass the font size via a parameter any more, it's done as a user input in the batch file.

E.g. NOT makefont 12 Lucida Grande.ttf or makefont Lucida Grande.ttf,
but makefont "Lucida Grande.ttf"
and
NOT makefont 12 "Lucida Grande.ttf" "Arial Black.ttf" "Square721 BT.ttf",
but makefont "Lucida Grande.ttf" "Arial Black.ttf" "Square721 BT.ttf"

It always prompts for font size (which is what allows the application to work correctly, as it can't be passed in using drag and drop), but pressing return causes it to default to 8pt.

I'll have a very quick think about a timeout, I've never played with that and now you've got me interested... ;)

It can't be done, at least not with the way I'm currently doing the font size input. it could be kludged by using a picklist of font sizes (press 'A' for 8pt, 'B' for 9 pt etc.) and a delayed loop, but it would be very untidy and, IMHO, not very user-friendly.

I would have thought most people would rather choose their font size than just let the program default and if the reason for not wanting an interruption is to do lots of fonts at once then the current implementation only requires setting the font size once for each batch of files dragged onto it.

And, at the end of the day, if people really want to make it do exactly what they want, they'll jump in a modify the batch file themselves.

You did say:
Oh, and if drag 'n' drop can work - even better! Would make it easier for noobs less talented people :P.

If it's the 'I just want it to work' group you are targetting, I would have thought drag and drop plus a straightforward font size prompt would be fine... and far easier than the command line approach.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 28, 2007, 07:08:08 AM
Hm... for sheer simplicity i really prefer to have a single user input over drag and drop, but maybe we can have two versions... i don't personally like that way of doing it... but i guess if people want it we can do it.

That being said... hmm...

Maybe it can detect if %1 is an integer - font size, and, if it is, convers with that size, and if not, prompts, waits ten seconds, or accepts the input, and converts... I'm sure it would be possible. We've done something similar before... Let me have a look...

As for the GUI i can make it in VB in about an hour, but it'll be ugly, slow and cumbersome, so i won't. I need something lightweight and preferably integrated like C, C++ or something, and I'm not even sure if ill try.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 28, 2007, 07:13:24 AM
Hm... for sheer simplicity i really prefer to have a single user input over drag and drop,

Oh well, my mistake in assuming you were very keen for drag and drop to work :(

How is command line typing simpler than drag and drop plus:
Enter required font size: _
In order to do what the application is designed for?

The two approaches (command line vs d'n'd) are mutually incompatible in this instance, because with d'n'd the parameters %1, %2 etc. are set to the filepaths of the dropped files. There is no way to pass in a single number as well.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 28, 2007, 07:17:19 AM
but i'm sure there must be a way - this is what i was thinking of:

Quote from: bascule
For my batch file, I used:

Quote
if %2 LEQ a (goto 2-CaseSizeSet) else (goto 2-CaseNoSize)


which returns TRUE if %2 is a numeric value, because all numbers are mathematically less than the alphabetic character 'a'.

We could somehow use that... it'd be complex... but it might just work your way and my way...

As for drag 'n' drop, I was keen for it, but then i decided i liked the ability to set the font size without editing the batch file - and i don't want to have the parogram wait for input - it should be (For me) straight from command to output, but i can appreciate that the new PC/Rockbox/DOS user would prefer to have the drag 'n' drop as well as the font sizing... so a hybrid must be possible.

EDIT: I really wish i had more time for this...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 28, 2007, 07:18:43 AM
OK, I'll leave it with you...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on February 28, 2007, 07:38:32 AM
Okay here's what i've hacked together in about 5 minutes.. it probably doesn't work, but it's how i'd expect it to work. I've commented on pretty much everything - so if you see something I've done wrong, feel free to correct me - It's based on bascule's latest one and i've added some code to check if a font size is set - na i think i did it wrong - if a font size is set it won't do multiple fonts... if i'm right... oh well il upload anyway so you get an idea of how i'm trying to do this (If it even helps)

THIS IS NOT A RELEASE - It's a very badly coded Beta.

[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 28, 2007, 08:39:57 AM
If you want to make my pre-drag and drop version work how I think you want it to work (although I'm confused now as to what you do want) all you need to do is this:

stick with the makefont [font size] filename1 [filename2 filename3 ...] syntax

But ensure that all spaced filenames are enclosed in quotes, thus making the whole filename a single parameter (This is what dragging and dropping does automatically, thus easing the interpretation of parameters) and ditch the looping filename construction, as it won't be required.
Do the first check on %1 for numeric value or not as per the existing method.
Loop through the parameters, converting each one individually.

E.g.:
makefont  19 "Lucida Grande.ttf" "Arial Black.ttf" "Square721 BT.ttf"
 Â        {%1}{        %2        }{       %3       }{       %4        }

So, yes, a hybrid is possible, as the above solution would also work for dropped files. All it may need is the addition that if %1 is non-numeric (i.e., dragged and dropped files), then jump to a font input routine.

What you can't have AFAIK is a way of defaulting the font size for command line users who do not enter one (presumably because they want the default), but requesting font size input for drag and droppers who will surely want that option, because they can't access a font size option any other way...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: DanManners on February 28, 2007, 03:02:17 PM
This is the SINGLEMOST useful tool anyone's released in a while, IMO. Thank you SO MUCH.

-Dan
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: ryran on February 28, 2007, 03:24:30 PM
Personally, I think the way Bascule did it in his last release makes the most sense.
And I second Dan--thank you guys so much.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on February 28, 2007, 05:05:57 PM
OK, I've caved, given the support from you guys :D

Attached is really my final effort, a hybrid app allowing drag and drop or command line usage. Fully tested and working provided the existing caveats are followed.

It only needed one extra line of code (and a modified integer/string check for the font size); even I couldn't complain about that...

Command Line syntax: makefont [font size] filename1 [filename2 filename3 ...]

Drag and Drop: Drop multiple font files onto the batch file. Enter the required font size when prompted, or [return] to default to 8pt.

Font size is optional in the Command Line, but will be prompted for if missing.
Fonts must be in the same folder as the app for both approaches.
Fonts with spaces in their names must be enclosed in quotes.

Command Line examples:
makefont  19 "Lucida Grande.ttf" "Arial Black.ttf" "Square721 BT.ttf"
makefont 12 "comic bold.ttf" comic.ttf
makefont arial.ttf
makefont arial.ttf "Square721 BT.ttf" lucida.ttf
makefont 14 arial.ttf "Square721 BT.ttf" lucida.ttf
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 01, 2007, 08:28:31 AM
It's... almost perfect - only problem is you didn't attach the file!

Seriously, man you rule. I hate not having any time to do this, otherwise i'd have done more...

So if you can post your "Final" version, then ill update the builds, help text and add my "Prettying-up" code to it, and it'll be the final-ish version, unless i think of something else to do with it.

Looking amazing - just upload it!!  :D
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on March 01, 2007, 08:42:44 AM
D'oh. I'm at work ATM, so it'll have to wait another 4-5 hours :(

EDIT:

Here it is, really attached this time...

Remember you'll still have to tidy up the help text and add any other frills/colours etc. that you want to :)

[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 01, 2007, 08:48:17 AM
D'oh!  have to go to bed, and i got school tomorrow, so you'll have to wait another 18 hours anyway!  ;D

Life's funny, innit. G'night all.  ;)
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: MrMEC on March 03, 2007, 03:45:12 PM
Just wanted to say that this is a great little program and it finally makes it possible for me to make my own fonts.  Thank you!  Fantastic job.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 03, 2007, 10:20:22 PM
Thanks bascule. I'll be updating this ASAP.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: delorean90 on March 04, 2007, 01:54:54 PM
i keep trying to make the font but i cant fiqure out how to do it  right could you please look this over and tell me what i am doing wrong

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\George W. Zadra>cd \

C:\>cd Documents and Settings\George W. Zadra\Desktop\Font Convertor

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>makefont[punchl
able.ttf]
'makefont[punchlable.ttf]' is not recognized as an internal or external command,

operable program or batch file.

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>makefont [punch
lable.ttf]


ROCKbox Font Convertor v1.1 (Release)
\----------------------------------------------------------------------------/
   Font Size: [punchlable.ttf]pt   Input File: ""
   Output File: "[punchlable.ttf]-.fnt"
 ----------------------------------------------------------------------------
  Converting TTF/OTF to BDF...
otf2bdf: invalid point size '0pt'.
                                                                         Done.
 ----------------------------------------------------------------------------
  Converting BDF to ROCKbox FNT...
Error opening file: [punchlable.ttf]-.bdf
                                                                         Done.
 ----------------------------------------------------------------------------
  Deleting temporary file(s) ("[punchlable.ttf]-.bdf")...
Could Not Find C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor\
[punchlable.ttf]-.bdf
                                                                         Done.
                                                        Press any key to exit.
 --------------------------------------ROCKbox - Open Source Jukebox Firmware-

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>makefont [punch
lable.ttf] [10]


ROCKbox Font Convertor v1.1 (Release)
\----------------------------------------------------------------------------/
   Font Size: [punchlable.ttf]pt   Input File: "[10]"
   Output File: "[punchlable.ttf]-[10].fnt"
 ----------------------------------------------------------------------------
  Converting TTF/OTF to BDF...
otf2bdf: invalid point size '0pt'.
                                                                         Done.
 ----------------------------------------------------------------------------
  Converting BDF to ROCKbox FNT...
Error opening file: [punchlable.ttf]-[10].bdf
                                                                         Done.
 ----------------------------------------------------------------------------
  Deleting temporary file(s) ("[punchlable.ttf]-[10].bdf")...
Could Not Find C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor\
[punchlable.ttf]-[10].bdf
                                                                         Done.
                                                        Press any key to exit.
 --------------------------------------ROCKbox - Open Source Jukebox Firmware-

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>C:\Documents an
d Settings\George W. Zadra\Desktop\Font Convertor\punchlabel.TTF"
'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>makefont [punch
lable.ttf]


ROCKbox Font Convertor v1.1 (Release)
\----------------------------------------------------------------------------/
   Font Size: [punchlable.ttf]pt   Input File: ""
   Output File: "[punchlable.ttf]-.fnt"
 ----------------------------------------------------------------------------
  Converting TTF/OTF to BDF...
otf2bdf: invalid point size '0pt'.
                                                                         Done.
 ----------------------------------------------------------------------------
  Converting BDF to ROCKbox FNT...
Error opening file: [punchlable.ttf]-.bdf
                                                                         Done.
 ----------------------------------------------------------------------------
  Deleting temporary file(s) ("[punchlable.ttf]-.bdf")...
Could Not Find C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor\
[punchlable.ttf]-.bdf
                                                                         Done.
                                                        Press any key to exit.
 --------------------------------------ROCKbox - Open Source Jukebox Firmware-

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>makefont [10]
[punchlable.ttf]


ROCKbox Font Convertor v1.1 (Release)
\----------------------------------------------------------------------------/
   Font Size: [10]pt   Input File: "[punchlable.ttf]"
   Output File: "[10]-[punchlable.ttf].fnt"
 ----------------------------------------------------------------------------
  Converting TTF/OTF to BDF...
otf2bdf: invalid point size '0pt'.
                                                                         Done.
 ----------------------------------------------------------------------------
  Converting BDF to ROCKbox FNT...
Error opening file: [10]-[punchlable.ttf].bdf
                                                                         Done.
 ----------------------------------------------------------------------------
  Deleting temporary file(s) ("[10]-[punchlable.ttf].bdf")...
Could Not Find C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor\
[10]-[punchlable.ttf].bdf
                                                                         Done.
                                                        Press any key to exit.
 --------------------------------------ROCKbox - Open Source Jukebox Firmware-

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>makefont [10pt]
 [punchlable.ttf]


ROCKbox Font Convertor v1.1 (Release)
\----------------------------------------------------------------------------/
   Font Size: [10pt]pt   Input File: "[punchlable.ttf]"
   Output File: "[10pt]-[punchlable.ttf].fnt"
 ----------------------------------------------------------------------------
  Converting TTF/OTF to BDF...
otf2bdf: invalid point size '0pt'.
                                                                         Done.
 ----------------------------------------------------------------------------
  Converting BDF to ROCKbox FNT...
Error opening file: [10pt]-[punchlable.ttf].bdf
                                                                         Done.
 ----------------------------------------------------------------------------
  Deleting temporary file(s) ("[10pt]-[punchlable.ttf].bdf")...
Could Not Find C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor\
[10pt]-[punchlable.ttf].bdf
                                                                         Done.
                                                        Press any key to exit.
 --------------------------------------ROCKbox - Open Source Jukebox Firmware-

C:\Documents and Settings\George W. Zadra\Desktop\Font Convertor>
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on March 04, 2007, 02:52:23 PM
You don't need the square brackets. In the standard notation of the syntax for command line operations, showing an item in square brackets means it is optional.

E.g., Command Line syntax: makefont [font size] filename1 [filename2 filename3 ...]

means that only a single filename is mandatory, both the font size and additional filenames are optional.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: delorean90 on March 04, 2007, 07:22:45 PM
Thanks i finaly have it now, i apreciate the help
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 05, 2007, 01:26:30 AM
Sorry if it wasn't very obvious... i didnt even use the notation correctly... =P

Will be fixed... just need time.

EDIT: The new version should be finished within a couple hours. I have more homework to finish.

EDIT: Sorry, i've been having problems. The current development version (What I've accomplished so far) is available at the follwing URL - It probably works, i just haven't finished/Tested it myself.
http://rockbox.biniaris.net/Files/imac/FontConvertor-unzipped/makefont.bat

There's some extra details (And a kinda sorta changelog) at

http://rockbox.biniaris.net/Files/imac/FontConvertor-unzipped/info.txt

And i think the links are now broken, so ill be fixing that soon.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on March 08, 2007, 09:42:13 AM
I've knocked another thing off your To Do list for the 1.2 version ;)

The attached batch file code checks for native .bdf font types and automatically skips the otf/ttf>bdf conversion step.

So you can now drag and drop a mixed bunch of .ttf, .otf and .bdf fonts onto makefont.bat and it will automagically convert them all to Rockbox .fnt format...

[attachment deleted by admin, too old]
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 09, 2007, 06:22:19 AM
Argh! Just as i get ready to release 1.1, you come along and do... this.

You're too fast!  :D

Oh well.. i have a tad less hacking to do now...  ;D

Thanks a bunch for your help.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: RowaN on March 11, 2007, 07:52:07 PM
It crashes when I try to convert my favourite font:

http://rapidshare.com/files/20589720/P0T-NOOD.ttf.html

Any ideas? Many thanks.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on March 12, 2007, 05:10:19 AM
Any ideas? Many thanks.

1. I can't get at you rapidshare file, it keeps telling me 'download session invalid'. This could be a corporate firewall problem on my side...

2. Are you using the 1.1 release version, or my latest attachment?

3. Exactly how are you trying to convert it? What do you mean by a 'crash'? Have you made a proper .bat file? Do you get any error messages?

etc., etc., ...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 12, 2007, 08:02:57 AM
I tested that font and the download works fine.

As for converting, i see what you mean. otf2BDF crashes out.

No idea why, but that font file looks corrupt to begin with. You sure the font is okay?

And i have no control over that... ill check if there's a new version of OTF2BDF, but i doubt it. - I didn't code the programs used, just tied them together.

EDIT: No, there's no update... ill have to research why it doesn't work... -v here we come...

EDIT2: Okay, well i tested it with the -v switch and got this:
Quote from: Command Prompt
otf2bdf: no character map for platform -1 encoding -1.  Generating all glyphs.
Anyone got any ideas?
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on March 12, 2007, 11:48:03 AM
Not any specific ideas, but it definitely looks like the .ttf is broken not compliant with the TrueType font standard somehow...
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: bascule on March 12, 2007, 12:17:41 PM
For those who can read code, that particular error message is located at line 1115 in the source code:

http://209.85.135.104/search?q=cache:1_C4EqigK_EJ:darwingrok.physics.ox.ac.uk:8080/source/s%3Fpath%3Dttf2bdf.c+ttf2bdf:+no+character+map+for+platform+-1+encoding+-1&hl=en&ct=clnk&cd=1
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: RowaN on March 12, 2007, 06:06:38 PM
Thanks for looking into this guys. Its a sorta homemade TTF from an "oldskewl" bbs font so i wouldnt be suprised if as bascule has said, its not a 100% compliant TTF file. I dont think it scales like a TTF should (its not meant to anyway..), its just got a fixed size within it. Here is how it should look. for those interested:
(http://img223.imageshack.us/img223/8114/p0tn00dleef6.gif)
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 13, 2007, 06:56:16 AM
the font looks cool... only it doesn't seem to be fully compatible.

Sorry about that!
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 20, 2007, 07:38:56 AM
Sorry i've not updated in a while guys. The code listed in the post up a few is basically the same as what the final release of the new version will be. I am going to be prettying up some of the ASCII now... something relevant yet interesting.

So update soon. If you can't wait, functionally it's all there in the above version.

EDIT: Here's what the new header is going to look like now:
Code: [Select]
/----------------------------------------------------------------------------\
 :::::::::   ::::::::   ::::::::  :::    ::: :::::::::   ::::::::  :::    :::
 :+:    :+: :+:    :+: :+:    :+: :+:   :+:  :+:    :+: :+:    :+: :+:    :+:
 +:+    +:+ +:+    +:+ +:+        +:+  +:+   +:+    +:+ +:+    +:+  +:+  +:+
 +#++:++#:  +#+    +:+ +#+        +#++:++    +#++:++#+  +#+    +:+   +#++:+
 +#+    +#+ +#+    +#+ +#+        +#+  +#+   +#+    +#+ +#+    +#+  +#+  +#+
 #+#    #+# #+#    #+# #+#    #+# #+#   #+#  #+#    #+# #+#    #+# #+#    #+#
 ###    ###  ########   ########  ###    ### #########   ########  ###    ###
      F    O    N    T         C    O    N    V    E    R    T    O    R
\----------------------------------------------------------------------------/

Comments? Hate it? Love it? Have a better idea? Please, comment away!

I would've used
Code: [Select]
__________               __   ___.                
\______   \ ____   ____ |  | _\_ |__   _______  ___
 |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 |    |   (  <_> )  \___|    < | \_\ (  <_> >    <
 |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
        \/            \/     \/    \/            \/

But .bat files don't like |s for some reason.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: lights0ut on March 20, 2007, 07:31:48 PM
I know this is a little off topic, but I was wondering if it's possible to get this to run under linux? ( I've just started running kubuntu, hoping I can run Linux as my primary OS and I don't want to boot to windows just to make fonts)

Thanks ;)
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: Llorean on March 20, 2007, 09:13:07 PM
All this is is a batch file for running two programs, one of which is included in the Rockbox tools. The other is this: http://crl.nmsu.edu/~mleisher/ttf2bdf.html

For a linux user, you should be able to knock together something that'll run the both of them on a file. This batch is mainly for windows users to be able to drag and drop, and the original descriptiong of it was even "So you don't have to remember the names of two programs"
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: lights0ut on March 21, 2007, 06:22:42 AM
sounds good, thanks Llorean. ;)

to comment on the art: I would prefer the usual logo that is found in most patches, but the one you've come up with is alright, good work. I'm glad that you feel pationate enough about your program to make some sweet ASCII for it ;).
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 21, 2007, 07:01:09 AM
I would make a linux version if i knew anything about linux. Batch files of this type were new to me at the start, but i had a basic (Read: Very Limited) understanding of DOS commands and scripting, so who knows. I might have a play later for a linux version.

Anyone want to comment on the art? Anyone got any ideas/suggestions for the art?
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: ryran on March 21, 2007, 07:19:35 PM
If you really want to know, personally I couldn't care less about ascii art. I'm barely gonna see it. However, I appreciate the convenience of the batch file and you're welcome to make it look however you want. :)
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on March 22, 2007, 04:50:12 AM
Well i just want to make it look good. I'm kinda obsessive compulsive when it comes to how my apps look. :P

Some neat ASCII was the obvious choice. I think i could do better though.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: iwantanimac on April 03, 2007, 10:32:44 AM
New Version Uploaded!

This is probably the last version that will be released unless i end up making it detect if it's a BDF you've supplied and just converts like that.

See the wiki page (Link in the first post) for the download links. I will be posting updates and links there from now on to save modifying t posts all the time.

EDIT: Bascule, the awesome guy, brought to my attention the fact that he'd already done the .bdf checking in a previous version. I, being the idiot i am, missed it - so a new version is in the works, combining the working version 1.2 and the .bdf checking.

Therefore, the zipped version is going on hold for now. You just need to get the latest .bat. Zips will come later.
Title: Re: [App] Rockbox Font Convertor [Windows]
Post by: fallenturtle on December 30, 2010, 07:27:14 PM
I was having an issue where the font I was converting (bitlow) was resulting in a few characters having a extra pixel of space to the left of the character while others didn't. I ended up fixing the troubled characters by opening the bdf in FontForge and adjusting the width.

Is there something I can select with the font converter to work around this? I tried setting the character spacing options in the ttf to bdf app, but none of those helped.