LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 10:05 AM   #1
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu 14.04 & 16.04 LTS; Android; Fedora
Posts: 195

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, 06:19 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,599

Rep: Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358
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, 06:22 AM   #3
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware, OpenBSD
Posts: 4,047
Blog Entries: 11

Rep: Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234
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, 08:44 AM   #4
DisgustedToast
LQ Newbie
 
Registered: Oct 2018
Posts: 2

Rep: Reputation: 0
Oh its very hard for me)
 
Old 10-26-2018, 09:22 AM   #5
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware, OpenBSD
Posts: 4,047
Blog Entries: 11

Rep: Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234
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, 10:53 AM   #6
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu 14.04 & 16.04 LTS; Android; Fedora
Posts: 195

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, 11:31 AM   #7
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,599

Rep: Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358
which gcc g++ is it? looks like you need a newer one.
 
1 members found this post helpful.
Old 10-26-2018, 12:04 PM   #8
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware, OpenBSD
Posts: 4,047
Blog Entries: 11

Rep: Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234
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 12:11 PM.
 
1 members found this post helpful.
Old 10-26-2018, 03:41 PM   #9
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu 14.04 & 16.04 LTS; Android; Fedora
Posts: 195

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, 05:38 AM   #10
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,599

Rep: Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358Reputation: 4358
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, 06:59 AM   #11
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu 14.04 & 16.04 LTS; Android; Fedora
Posts: 195

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 13 03-18-2015 08:49 AM
12.04 Browser fonts changed unexpectedly after installing new fonts and rebooting jdier Linux - Software 1 11-19-2012 12:51 PM
GRUB Customization (fonts) steak1987 Linux - General 10 10-26-2012 10:53 AM
A frontend to change the fonts of xterm/mrxvt using the ~/.fonts folder ? frenchn00b Linux - General 1 05-28-2008 01:28 PM
Any way to convert ttf fonts to linux console fonts? Glockage Linux - Software 7 12-30-2002 07:41 AM

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

All times are GMT -5. The time now is 01:02 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration