Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new font flag #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

added new font flag #23

wants to merge 2 commits into from

Conversation

satooru
Copy link

@satooru satooru commented Oct 7, 2019

so far, this is what I've done:

  • added a new flag (-font or -f)
  • created a new folder "Matter/fonts" and added the ttf files
  • script calling grub-mkfont

To be honest, I'm kinda lost...

I'm not sure if this is what you are looking for or if I'm on the right track. I'm looking for some input/feedback.

Also I have some questions:

  1. I have no idea how to test my modification since I'm not running dual boot, do you have any tips about testing without grub installed?
  2. What should I do with theme.txt described in the issue? Do you have a template or an example?

If there is something you'd like to ask, let me know.
Thank you!

@satooru
Copy link
Author

satooru commented Oct 7, 2019

referencing issue #18

@mateosss
Copy link
Owner

mateosss commented Oct 8, 2019

This seems as exactly what I expected!

But the fonts folder should be outside Matter, because Matter is the final folder that gets moved to the system grub files, so it should be as small as possible. Make a fonts folder alongside svg-icons.

Regarding your questions:

  1. I should probably reference this in the readme, but I use a lubuntu ISO installed on virtualbox, read this.
    My testing workflow is: run set-matter.sh, copy a custom grub.cfg file into /boot/grub/grub.cfg and then restart with RightCtrl+R.
  2. In Matter/theme.txt there are many references to GoogleSans Regular 32 which is the name of the current font, you should replace those lines when running set-matter.sh with the proper font name, howevere I don't quite remember how I got the name GoogleSans Regular 32, I guess that one is for you to look up!

@satooru
Copy link
Author

satooru commented Oct 8, 2019

Is this a high priority issue? Because I probably won't be able to work on it until weekend... I'm sorry

supported_fonts=(poiret-one karla pattaya)

# Set the chosen font
if [[ ! " ${FONT} " == " " ]] && [[ " ${supported_fonts[@] " =~ " ${FONT} " ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${supported_fonts[@]}
right curly brace is missing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will fix it in the next commit

@@ -18,6 +18,11 @@ case $key in
shift # past argument
shift # past value
;;
-f|--font)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess since this is written in a case switch so we cannot have both the options -p and -f working together.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually fine. If you want to know why i suggest you to read the documentation for shift command here :). What is happening in this while loop is that it checks for all flags attached to the command and processes them one by one.

# Set the chosen font
if [[ ! " ${FONT} " == " " ]] && [[ " ${supported_fonts[@] " =~ " ${FONT} " ]]; then
echo -e "Setting font to ${FONT}"
grub-mkfont "./Matter/fonts/${FONT}/${FONT}-regular.ttf"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to supply an output path like grub-mkfont -s 20 -o /Matter/${FONT}.pf2 "./Matter/fonts/${FONT}/${FONT}-regular.ttf"

But even if we do so, and change the contents of theme.txt by sed (as is done for palette colors), still the generated pf2 font file will remain in the current directory (not copied to the /boot/grub/themes/Matter dir) because the Matter dir is being copied to the /boot/grub/themes/Matter dir even before the palette colors are changed. It is being changed directly into the theme.txt which is present in the /boot/grub/themes/Matter dir by sed.

What I have done so far (because I don't know how to do it) is to manually copy the generated pf2 file after the Matter dir has been copied to /boot/grub/themes/ dir and replaced the font in theme.txt manually. This works on my system but it should really be incorporated into this script.
Therefore, the things to be done may include -

  • adding support for both -p and -f options
  • for -f option, generate and copy the pf2 file to the /boot/grub/themes/Matter dir
  • change font in theme.txt

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be solved by moving the # Copy theme just above # Set theme and options like -p and -f should modify the local Matter folder before moving it to /boot/grub/themes

@4ndrej 4ndrej mentioned this pull request Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants