LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-25-2018, 09:05 AM   #1
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Rep: Reputation: Disabled
C++ and Grub Fonts


I have a need (well, ok, a desire) to edit a font in pf2 format used (I believe) only by GRUB and to use that font on the grub menu in the newest version 19 of Linux Mint. The only utility that purports to be able to do edit such fonts is a pair of C++ apps located at:

Code:
https://github.com/wareya/ffam/blob/master/ffam-build.cpp
https://github.com/wareya/ffam/blob/master/ffam-rip.cpp
ffam-rip converts a pf2 font to an editable format, and ffam-build rebuilds the result into a new pf2 font. It sounds like just what I need, but these seem to only be available as source code at the referenced github locations. This is a fresh installation of Linux Mint 19, so I went ahead and installed g++ and the build-essential package and tried

Code:
g++ ffam-rip.cpp -o pfrip
This gave me the following error

Code:
ffam-rip.cpp:2:22: fatal error: SDL2/SDL.h: No such file or directory
compilation terminated.
Ok, I should have glanced at the source more carefully, but I was in a hurry. I looked in synaptic and found nothing resembling SDL. Trolling around the internet, I located the following:

Code:
https://github.com/emscripten-ports/SDL2/blob/master/include/SDL.h
To preclude being boring or embarassing myself, I'll stop short here; the bottom line is that I was unable to get either utility compiled. Can anyone tell me what I'm missing? ... and hopefully list the exact steps I would need to compile these; they are quite short (only about 500 generously spaced lines each). I've been away from this stuff for long enough that I don't think I have a lot of chance of unraveling this any time soon.

OR: if anyone knows of some other way to edit pf2 fonts (or even the more obscure .pcf.gz font format), I'm all ears.

Thanks much.
 
Old 10-26-2018, 05:19 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
you need to install libsdl2-dev I think
Code:
$ g++ ffam-rip.cpp -o ffam-rip -l SDL2
$ g++ -o ffam-build ffam-build.cpp -l SDL2
both worked well.
 
Old 10-26-2018, 05:22 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,680
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
I suspect that these programs were never meant to be installed as orphans. Probably you have to download the whole ffam package. That's how Linux programs almost always come to you: as a package.

There should be an opportunity to download the package as a tarball (a zipped archive). When you unpack it, there should be a README or INSTALL file that will tell you how to proceed. Nine times out of ten, it's just "./configure, make, sudo make install".
 
Old 10-26-2018, 07:44 AM   #4
DisgustedToast
LQ Newbie
 
Registered: Oct 2018
Posts: 2

Rep: Reputation: 0
Oh its very hard for me)
 
Old 10-26-2018, 08:22 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,680
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Quote:
Originally Posted by DisgustedToast View Post
Oh its very hard for me)
You chose an ambitious project so don't moan!

Anyway I went to the site to look for myself and I was wrong about it being a package. It's just those two programs, as you thought.

Just follow pan64's instruction and use apt to install libsdl (if not already installed) and libsdl-dev. Then compile the programs again.
 
Old 10-26-2018, 09:53 AM   #6
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Original Poster
Rep: Reputation: Disabled
Thanks all for your replies, but I had already installed libsdl2-2.0-0 and libsdl2-dev packages; when running the command line you suggested:

Quote:
g++ ffam-rip.cpp -o ffam-rip -l SDL2
I got the following:

Quote:
ffam-rip.cpp:26:22: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
std::string NAME="";
^
ffam-rip.cpp:30:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 PTSZ = ~0;
^
ffam-rip.cpp:31:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 MAXW = ~0;
^
ffam-rip.cpp:32:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 MAXH = ~0;
^
ffam-rip.cpp:33:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 ASCE = ~0;
^
ffam-rip.cpp:34:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 DESC = ~0;
^
ffam-rip.cpp: In function ‘int main(int, char**)’:
ffam-rip.cpp:252:10: error: ‘start’ does not name a type
auto start = ftell(f);
^
ffam-rip.cpp:275:23: error: ‘nullptr’ was not declared in this scope
char * data = nullptr;
^
ffam-rip.cpp:291:22: error: ‘j’ does not name a type
for(auto j=0;j<8;j++)
^
ffam-rip.cpp:291:26: error: expected ‘;’ before ‘j’
for(auto j=0;j<8;j++)
^
ffam-rip.cpp:291:26: error: ‘j’ was not declared in this scope
ffam-rip.cpp:295:22: error: ‘b’ does not name a type
auto b = 128>>j;
^
ffam-rip.cpp:296:39: error: ‘b’ was not declared in this scope
setpixels += (data[i]&b)!=0;
^
ffam-rip.cpp:312:21: error: ‘class std::map<unsigned int, chardef>’ has no member named ‘emplace’
definitions.emplace(addr,mydef);
^
ffam-rip.cpp:319:10: error: ‘test’ does not name a type
auto test = fopen(outtxt.data(), "w");
^
ffam-rip.cpp:321:13: error: ‘test’ was not declared in this scope
fprintf(test, "NAME=%s\n",myfont.NAME.data());
^
ffam-rip.cpp:333:14: error: ‘c’ does not name a type
for(auto c : myfont.CHIX)
^
ffam-rip.cpp:344:5: error: expected ‘;’ before ‘uint’
uint d_cols = display; // display columns
^
ffam-rip.cpp:346:9: error: expected primary-expression before ‘dwidth’
u32 dwidth = sumWidth;
^
ffam-rip.cpp:346:9: error: expected ‘)’ before ‘dwidth’
ffam-rip.cpp:346:9: error: ‘dwidth’ was not declared in this scope
ffam-rip.cpp:352:9: error: ‘dwidth’ was not declared in this scope
dwidth = (myfont.MAXW+s_boxpad+2)*d_cols+s_boxpad;
^
ffam-rip.cpp:352:43: error: ‘d_cols’ was not declared in this scope
dwidth = (myfont.MAXW+s_boxpad+2)*d_cols+s_boxpad;
^
ffam-rip.cpp:357:30: error: ‘dwidth’ was not declared in this scope
printf("%dx%d\n",dheight,dwidth);
^
ffam-rip.cpp:369:14: error: ‘c’ does not name a type
for(auto c : myfont.CHIX)
^
In file included from /usr/include/SDL2/SDL_video.h:34:0,
from /usr/include/SDL2/SDL_events.h:33,
from /usr/include/SDL2/SDL.h:41,
from ffam-rip.cpp:7:
ffam-rip.cpp:446:5: error: expected ‘;’ before ‘SDL_SaveBMP_RW’
SDL_SaveBMP(myimage, outbmp.data());
^
ffam-rip.cpp:447:29: error: expected ‘)’ before ‘;’ token
SDL_FreeSurface(myimage);
That led me to believe that there was something more fundamental that I was missing. I did notice just now while confirming the version number in Synaptic, however, that there are also some libsdl1.x packages installed as well. Might that be confusing things?

Thanks again for responding.
 
Old 10-26-2018, 10:31 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
which gcc g++ is it? looks like you need a newer one.
 
1 members found this post helpful.
Old 10-26-2018, 11:04 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,680
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
What about if you add -std=gnu++11 to your build line?
Quote:
Originally Posted by GCC man page
-std= Determine the language standard. This option is currently only supported when compiling C or C++.
gnu++11 GNU dialect of -std=c++11.

Last edited by hazel; 10-26-2018 at 11:11 AM.
 
1 members found this post helpful.
Old 10-26-2018, 02:41 PM   #9
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Original Poster
Rep: Reputation: Disabled
Hazel: Thanks much; adding that line did the trick. If it's not a whole lot of trouble, could you explain to me how you came up with that suggestion? I assume there were certain hints in the output I posted that suggested I was using an older/newer flavor of c++, but I'm curious...

pan64: I was dismayed to find that simply installing the gcc/g++ compiler from the command line didn't tell me that I had so many version choices available, so you are undoubtedly correct. A trip to Synaptic showed at least two other versions I could have chosen. That would have left me scratching my head as to what the correct choice might have been, but at least I could have asked a better question. Could I ask you as well, what prompted you to suggest that.

Again, thanks much to both of you.
 
Old 10-27-2018, 04:38 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
the error message you posted means the syntax of the source files were based on C++ version 11. This is relatively new, so either the compiler you use still did not understand it or the default is an earlier version. In your case -std=gnu++11 solved the issue, that means the latter.
 
Old 10-27-2018, 05:59 AM   #11
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Original Poster
Rep: Reputation: Disabled
Thanks much;

Now that you've explained it and I go back and read things like "only available with -std=c++11 or -std=gnu++11" that explanation makes perfect sense. It's almost embarrassing even. I looked in Synaptic and the installed/default versions are indeed not the most recent available; so I'm guessing that the compiler itself has internal defaults as to which source version it expects to be fed. If I get the time, I'll replace it with the newest G++ and see if it still needs the "-std=gnu++11" on the command line.

Again thanks to both of you. I've been retired for more than ten years now, and don't really keep up as well as I could.
 
  


Reply

Tags
c++ compiler, fonts, grub 2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting classic Slackware fonts (.fnt) to TrueType fonts? jeremya Slackware 14 09-14-2020 11:21 PM
GRUB Customization (fonts) steak1987 Linux - General 11 05-12-2020 08:35 PM
12.04 Browser fonts changed unexpectedly after installing new fonts and rebooting jdier Linux - Software 1 11-19-2012 11:51 AM
A frontend to change the fonts of xterm/mrxvt using the ~/.fonts folder ? frenchn00b Linux - General 1 05-28-2008 12:28 PM
Any way to convert ttf fonts to linux console fonts? Glockage Linux - Software 7 12-30-2002 06:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration