Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  [App] Rockbox Font Convertor [Windows]
« previous next »
  • Print
Pages: 1 [2] 3 4 5

Author Topic: [App] Rockbox Font Convertor [Windows]  (Read 35748 times)

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: [App] Rockbox Font Convertor [Windows]
« Reply #15 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...
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

Offline JustJohnny

  • Member
  • *
  • Posts: 51
Re: [App] Rockbox Font Convertor [Windows]
« Reply #16 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.
Logged

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: [App] Rockbox Font Convertor [Windows]
« Reply #17 on: February 26, 2007, 04:48:28 AM »
Quote from: JustJohnny on February 25, 2007, 09:11:42 PM
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'.
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: [App] Rockbox Font Convertor [Windows]
« Reply #18 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]
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

Offline JustJohnny

  • Member
  • *
  • Posts: 51
Re: [App] Rockbox Font Convertor [Windows]
« Reply #19 on: February 26, 2007, 09:53:08 AM »
Quote from: 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).


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.
« Last Edit: February 26, 2007, 10:46:39 AM by JustJohnny »
Logged

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: [App] Rockbox Font Convertor [Windows]
« Reply #20 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?
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

Offline ryran

  • Member
  • *
  • Posts: 379
    • b19 photography
Re: [App] Rockbox Font Convertor [Windows]
« Reply #21 on: February 26, 2007, 01:25:45 PM »
Hah. Nice work you two.
Logged

Offline iwantanimac

  • Member
  • *
  • Posts: 42
  • Rockbox <3er.
    • GSh Blog
Re: [App] Rockbox Font Convertor [Windows]
« Reply #22 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.
« Last Edit: February 27, 2007, 07:58:38 AM by iwantanimac »
Logged

Offline iwantanimac

  • Member
  • *
  • Posts: 42
  • Rockbox <3er.
    • GSh Blog
Re: [App] Rockbox Font Convertor [Windows]
« Reply #23 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
Logged

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: [App] Rockbox Font Convertor [Windows]
« Reply #24 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]
« Last Edit: February 27, 2007, 10:58:31 AM by bascule »
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

Offline ryran

  • Member
  • *
  • Posts: 379
    • b19 photography
Re: [App] Rockbox Font Convertor [Windows]
« Reply #25 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.
Logged

Offline iwantanimac

  • Member
  • *
  • Posts: 42
  • Rockbox <3er.
    • GSh Blog
Re: [App] Rockbox Font Convertor [Windows]
« Reply #26 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!
Logged

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: [App] Rockbox Font Convertor [Windows]
« Reply #27 on: February 28, 2007, 05:06:55 AM »
Quote from: iwantanimac on February 28, 2007, 03:32:03 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.

Quote from: iwantanimac on February 28, 2007, 03:32:03 AM
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 ;)

Quote from: iwantanimac on February 28, 2007, 03:32:03 AM
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.

Quote from: iwantanimac on February 28, 2007, 03:32:03 AM
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.
« Last Edit: February 28, 2007, 05:31:03 AM by bascule »
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

Offline iwantanimac

  • Member
  • *
  • Posts: 42
  • Rockbox <3er.
    • GSh Blog
Re: [App] Rockbox Font Convertor [Windows]
« Reply #28 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...
Logged

Offline bascule

  • Rockbox Expert
  • Member
  • *
  • Posts: 1298
Re: [App] Rockbox Font Convertor [Windows]
« Reply #29 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:
Quote from: iwantanimac on February 27, 2007, 05:29:36 AM
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.
« Last Edit: February 28, 2007, 07:06:56 AM by bascule »
Logged
DataBase fanboy and author of the totally overhauled Rockbox Sync Tool

  • Print
Pages: 1 [2] 3 4 5
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  [App] Rockbox Font Convertor [Windows]
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.246 seconds with 21 queries.