issue170:tutoriel2
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue170:tutoriel2 [2021/06/28 16:28] – auntiee | issue170:tutoriel2 [2021/06/30 16:12] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 5: | Ligne 5: | ||
The GRUB manual gives details about this procedure but there are fundamentally 3 steps:** | The GRUB manual gives details about this procedure but there are fundamentally 3 steps:** | ||
- | L'une des très nombreuses caractéristiques géniales d' | + | L'une des très nombreuses caractéristiques géniales d' |
- | J'ai décidé de peaufiner l' | + | J'ai décidé de peaufiner l' |
- | Le manuel de GRUB donne des détails de ce procédure, mais il y a essentiellement 3 étapes : | + | Le manuel de GRUB donne des détails de cette procédure, mais il y a essentiellement 3 étapes : |
**1. Get an image to use – it must be 256 color non-indexed RGB, and preferably in PNG format. There are lots of places to download free background images, I got mine from https:// | **1. Get an image to use – it must be 256 color non-indexed RGB, and preferably in PNG format. There are lots of places to download free background images, I got mine from https:// | ||
Ligne 27: | Ligne 27: | ||
to create a new GRUB configuration file that reflects this change. You should see that the update finds the background image and ends without error. Reboot!** | to create a new GRUB configuration file that reflects this change. You should see that the update finds the background image and ends without error. Reboot!** | ||
- | 1. Recupérez | + | 1. Récupérez |
En tant d' | En tant d' | ||
Ligne 35: | Ligne 35: | ||
GRUB_GFXMODE=" | GRUB_GFXMODE=" | ||
- | Si une autre commande GRUB-GFXMODE est déjà dans le fichier, il suffit d' | + | Si une autre commande GRUB-GFXMODE est déjà dans le fichier, il suffit d' |
3. Ouvrez un terminal et tapez : | 3. Ouvrez un terminal et tapez : | ||
Ligne 41: | Ligne 41: | ||
sudo update-grub | sudo update-grub | ||
- | pour créer un nouveau fichier de configuration de GRUB qui réflète | + | pour créer un nouveau fichier de configuration de GRUB qui reflète |
- | Well, the background certainly shows up (next page, top), but the font is rather small; and, on a 1920 x 1080 screen, this effect is even more pronounced. The reason is simple enough: GRUB uses a default resolution of 640 x 480 (text mode), and employs a bitmap font that is appropriate for that resolution. When you change the resolution to 1366 x 768, the pixels are smaller and so the displayed font is also reduced in size. GRUB provides only one font for its use (you will see it as unifont.pf2 in the grub folder), so if you want something larger it is necessary to use a different font entirely that can be scaled appropriately. | + | **Well, the background certainly shows up (next page, top), but the font is rather small; and, on a 1920 x 1080 screen, this effect is even more pronounced. The reason is simple enough: GRUB uses a default resolution of 640 x 480 (text mode), and employs a bitmap font that is appropriate for that resolution. When you change the resolution to 1366 x 768, the pixels are smaller and so the displayed font is also reduced in size. GRUB provides only one font for its use (you will see it as unifont.pf2 in the grub folder), so if you want something larger it is necessary to use a different font entirely that can be scaled appropriately. |
Fortunately GRUB provides a handy utility for just this purpose, so we can use any monospaced font and convert it to the .pf2 format that GRUB requires. There are lots of fonts on your system already, so let’s use one. Copy the font file: | Fortunately GRUB provides a handy utility for just this purpose, so we can use any monospaced font and convert it to the .pf2 format that GRUB requires. There are lots of fonts on your system already, so let’s use one. Copy the font file: | ||
Ligne 51: | Ligne 51: | ||
to your Desktop, so that the font is conveniently located for the next steps. Now open a Terminal and type: | to your Desktop, so that the font is conveniently located for the next steps. Now open a Terminal and type: | ||
+ | |||
+ | grub-mkfont -s 24 -o UbuntuMono.pf2 UbuntuMono-R.ttf** | ||
+ | |||
+ | Eh bien, l' | ||
+ | |||
+ | Heureusement, | ||
+ | |||
+ | / | ||
+ | |||
+ | sur votre bureau, pour que la police soit d'un accès facile pour les prochaines étapes. Maintenant, ouvrez un terminal et tapez : | ||
grub-mkfont -s 24 -o UbuntuMono.pf2 UbuntuMono-R.ttf | grub-mkfont -s 24 -o UbuntuMono.pf2 UbuntuMono-R.ttf | ||
- | The -s 24 option sets the size and the -o option is followed by the name of the output file. This command provides a bitmap file for GRUB to use that is bigger, and so should display better. Copy the file UbuntuMono.pf2 from your Desktop into the / | + | |
+ | **The -s 24 option sets the size and the -o option is followed by the name of the output file. This command provides a bitmap file for GRUB to use that is bigger, and so should display better. Copy the file UbuntuMono.pf2 from your Desktop into the / | ||
GRUB_FONT="/ | GRUB_FONT="/ | ||
Ligne 64: | Ligne 75: | ||
and reboot to see the effect that this has on the GRUB boot menu (shown bottom left). | and reboot to see the effect that this has on the GRUB boot menu (shown bottom left). | ||
- | The font is Ubuntu Mono and it is a good size; but, the box is not drawn correctly. | + | The font is Ubuntu Mono and it is a good size; but, the box is not drawn correctly.** |
- | Let’s try a different font to establish if the problem is the particular Ubuntu font that we used, or the method itself. This time copy the font | + | L' |
+ | |||
+ | GRUB_FONT="/ | ||
+ | |||
+ | Enregistrez le fichier, ouvrez un terminal et tapez : | ||
+ | |||
+ | sudo update-grub | ||
+ | |||
+ | puis redémarrer pour voir son effet sur le menu boot de GRUB (voir en bas à gauche). | ||
+ | |||
+ | La police est Ubuntu Mono et elle est d'une taille convenable, mais le cadre n'est pas dessiné correctement. | ||
+ | |||
+ | **Let’s try a different font to establish if the problem is the particular Ubuntu font that we used, or the method itself. This time copy the font | ||
/ | / | ||
Ligne 72: | Ligne 95: | ||
to the Desktop, and repeat the sequence of steps above, changing file names as appropriate. Reboot and check the display (shown below). This result is close to what we want, but the box has gaps in it so there is still something that is not quite right. | to the Desktop, and repeat the sequence of steps above, changing file names as appropriate. Reboot and check the display (shown below). This result is close to what we want, but the box has gaps in it so there is still something that is not quite right. | ||
- | Let's try one last font to see what happens. This time I am going to use a font called Terminus, available for download from http:// | + | Let's try one last font to see what happens. This time I am going to use a font called Terminus, available for download from http:// |
+ | |||
+ | Essayons une autre police pour tenter de savoir si c'est précisément la police Ubuntu qu'on a utilisée qui est le problème, ou si c'est la méthode elle-même. Cette fois ci, copiez la police : | ||
+ | |||
+ | / | ||
+ | |||
+ | sur votre bureau et répétez les étapes ci-dessus en changeant le nom des fichiers au besoin. Redémarrez et vérifiez l' | ||
+ | |||
+ | Essayons une toute dernière police pour voir ce qui se passe. Cette fois-ci, j' | ||
- | Extract the resulting archive into your Download folder and open the folder terminus-font-4.49 to see the font files contained inside. You will note that the folder contains a number of different font sizes in regular and bold weights, which makes it a very flexible bitmap font to use. Copy the file ter-u24b.bdf | + | **Extract the resulting archive into your Download folder and open the folder terminus-font-4.49 to see the font files contained inside. You will note that the folder contains a number of different font sizes in regular and bold weights, which makes it a very flexible bitmap font to use. Copy the file ter-u24b.bdf |
to the Desktop, this is the 24-point bold version of the font. The reason why I have chosen this font will be clear in a moment; for the time being, follow the sequence of steps above, changing file names as appropriate, | to the Desktop, this is the 24-point bold version of the font. The reason why I have chosen this font will be clear in a moment; for the time being, follow the sequence of steps above, changing file names as appropriate, | ||
- | Exactly what we wanted! A clear, easy to read font with a properly drawn box and an attractive background. This progression of steps and the problems that arose are helpful in understanding what is going on here and making sense of what we have done. Firstly, GRUB only understands pf2 font files, a special bitmap format created specifically for GRUB. The utility grub-mkfont takes Truetype fonts (which are defined by outlines), resizes them and converts the original Truetype font to the pf2 bitmap format. Imagine that you have a 12 x 24 grid and you draw a letter outline on the grid. Some of the pixels on the border will be partially inside the letter and partly outside so the computer has to decide to include or exclude those pixels. It does a pretty good job; but, the process does introduce some inaccuracies so you might end up with extra pixels where you don't want them or missing pixels where you do want them. | + | Exactly what we wanted! A clear, easy to read font with a properly drawn box and an attractive background. This progression of steps and the problems that arose are helpful in understanding what is going on here and making sense of what we have done. Firstly, GRUB only understands pf2 font files, a special bitmap format created specifically for GRUB. The utility grub-mkfont takes Truetype fonts (which are defined by outlines), resizes them and converts the original Truetype font to the pf2 bitmap format. Imagine that you have a 12 x 24 grid and you draw a letter outline on the grid. Some of the pixels on the border will be partially inside the letter and partly outside so the computer has to decide to include or exclude those pixels. It does a pretty good job; but, the process does introduce some inaccuracies so you might end up with extra pixels where you don't want them or missing pixels where you do want them.** |
- | This is exactly the reason the DejaVu font displayed the box with gaps: the vertical box drawing character has missing pixels after the conversion to bitmap format. The Terminus font, designed by Dimitar Zhekov, is a bitmap font to start with (BDF format) and the one we used was already 24 pixels in size so grub-mkfont does not need to resize it or convert it to bitmap format. Consequently, | + | Décompressez l' |
+ | |||
+ | C'est exactement ce que nous voulions ! Une police claire et lisible avec un cadre dessiné comme il faut et un arrière-plan attrayant. Cette progression d' | ||
+ | |||
+ | |||
+ | |||
+ | **This is exactly the reason the DejaVu font displayed the box with gaps: the vertical box drawing character has missing pixels after the conversion to bitmap format. The Terminus font, designed by Dimitar Zhekov, is a bitmap font to start with (BDF format) and the one we used was already 24 pixels in size so grub-mkfont does not need to resize it or convert it to bitmap format. Consequently, | ||
On the one hand, this could be the end of the story as we have a nice GRUB screen which was, after all, the point of the exercise; and, because Terminus is available in a variety of sizes, it is possible to pick a size that suits your personal tastes. And, because they are all designed from scratch rather than being resized, they all look terrific. However, if you really would prefer another font style, there is a rather straightforward answer to the problem of fonts being distorted by grub-mkfont. The solution is to use a program called gbdfed to do the conversion from a Truetype font to an editable BDF font file. After fixing any problems introduced by the conversion to bitmap format, grub-mkfont can be used on this tweaked BDF font to produce a pf2 font that works as it should. You can install gbdfed with Synaptic, through the Software Center or using apt-get, whichever you prefer. You can create a launcher on the Desktop or press Alt-F2 to run it if it does not appear in your menu or dash. | On the one hand, this could be the end of the story as we have a nice GRUB screen which was, after all, the point of the exercise; and, because Terminus is available in a variety of sizes, it is possible to pick a size that suits your personal tastes. And, because they are all designed from scratch rather than being resized, they all look terrific. However, if you really would prefer another font style, there is a rather straightforward answer to the problem of fonts being distorted by grub-mkfont. The solution is to use a program called gbdfed to do the conversion from a Truetype font to an editable BDF font file. After fixing any problems introduced by the conversion to bitmap format, grub-mkfont can be used on this tweaked BDF font to produce a pf2 font that works as it should. You can install gbdfed with Synaptic, through the Software Center or using apt-get, whichever you prefer. You can create a launcher on the Desktop or press Alt-F2 to run it if it does not appear in your menu or dash. | ||
- | If you select File > Import > OpenType Font and then navigate to / | + | If you select File > Import > OpenType Font and then navigate to / |
+ | |||
+ | C'est exactement pour cela que le cadre avait des trous avec la police DejaVu : une fois converti au format bitmap, des pixels manquent au caractère qui est dessiné verticalement dans la boîte. La police Terminus, conçue par Dimitar Zhekov, est une police bitmap dès le départ (format BDF) et celle que nous avons utilisée faisait déjà 24 pixels ; aussi, grub-mkfont n'a pas besoin de la redimensionner ou de la convertir au format bitmap. Par conséquence, | ||
+ | |||
+ | D'un côté, cela pourrait être la fin de notre histoire, comme nous avons un écran GRUB attrayant, ce qui était, après tout, le but de l' | ||
+ | |||
+ | Si vous sélectionnez Fichier > Importer > Police OpenType puis naviguez vers / | ||
+ | |||
+ | |||
+ | **As you see, the program does a pretty good job, but I like to double-click on the zero character and just page through each character, upper and lower case, using the arrows at the top right of the window to see if anything untoward appears to your eye. You will likely find the odd extra pixel or unbalanced character that can be fixed by adding a pixel or two. For example, a number of the capital letters appear to have one side of the letter thicker than the other (E, H, P, and U) , and the lowercase " | ||
- | As you see, the program does a pretty good job, but I like to double-click on the zero character and just page through each character, upper and lower case, using the arrows at the top right of the window to see if anything untoward appears to your eye. You will likely find the odd extra pixel or unbalanced character that can be fixed by adding a pixel or two. For example, a number of the capital letters appear to have one side of the letter thicker than the other (E, H, P, and U) , and the lowercase " | ||
Now it's time to fix the box-drawing characters. Type 74 in the Page box or 2500 in the Code box and press enter. You will see that, as well as the four corners, are designated 2501, 2503, 250F, 2513, 2517 and 251B. | Now it's time to fix the box-drawing characters. Type 74 in the Page box or 2500 in the Code box and press enter. You will see that, as well as the four corners, are designated 2501, 2503, 250F, 2513, 2517 and 251B. | ||
Each of these characters has missing pixels which is why the box that was drawn on the GRUB boot menu had gaps in it. All that is required is to fill in the missing pixels so that the characters reach all the way to the edge(s) of the bounding box. The red squares show where pixels need to be added. Similarly, the corners need to be adjusted so that they reach both horizontal and vertical boundaries.Repeat the process for the other 3 characters. Once all 6 characters have been adjusted, save the file again and you now have a " | Each of these characters has missing pixels which is why the box that was drawn on the GRUB boot menu had gaps in it. All that is required is to fill in the missing pixels so that the characters reach all the way to the edge(s) of the bounding box. The red squares show where pixels need to be added. Similarly, the corners need to be adjusted so that they reach both horizontal and vertical boundaries.Repeat the process for the other 3 characters. Once all 6 characters have been adjusted, save the file again and you now have a " | ||
- | The problem with the Ubuntu Font was that the characters for the bounding box were missing entirely so if you wanted to use this font you would need to draw your own characters in the appropriate character boxes. Not difficult, just make sure that everything lines up with the corners and the horizontal and vertical bars. In addition, the characters for up (2191) and down (2193) arrows are often missing so these might need to be added also. | ||
- | Since we have come this far, it is worth looking at how to modify the colors of the text. There are many ways of doing this, but, in my view, the easiest is to create a small text file in the /boot/grub folder from which GRUB can read your color choices. Type the following lines into this file: | + | The problem with the Ubuntu Font was that the characters for the bounding box were missing entirely so if you wanted to use this font you would need to draw your own characters in the appropriate character boxes. Not difficult, just make sure that everything lines up with the corners and the horizontal and vertical bars. In addition, the characters for up (2191) and down (2193) arrows are often missing so these might need to be added also.** |
+ | |||
+ | Comme vous pouvez le voir, le programme fait du bon boulot, mais j'aime double-cliquer sur le caractère 0, puis regarder chaque caractère, majuscule et minuscule, en utilisant les flèches en haut et à droite de la fenêtre pour voir si mon œil capte quelque chose de malencontreux. Vous trouverez sans doute un pixel supplémentaire ici ou là ou un caractère déséquilibré qui peut être corrigé en ajoutant quelques pixels. Par exemple, de nombreuses lettres majuscules semblent avoir un côté plus épais que l' | ||
+ | |||
+ | Le moment est venu de réparer les caractères qui dessinent le cadre. Tapez 74 dans la boîte Page ou 2500 dans la boîte Code et appuyez sur Entrée. Vous verrez que ces boîtes et les quatre coins, sont référencés 2501, 2503, 250F, 2513, 2517 et 251B. | ||
+ | |||
+ | Des pixels manquent à chacun de ces caractères, | ||
+ | |||
+ | Le problème de la police Ubuntu était que les caractères utilisés pour le cadre étaient entièrement absents ; aussi, si vous vouliez utiliser cette police, vous deviez dessiner vos propres caractères dans boîtes de caractères appropriées. Ce n'est pas difficile : il suffit de vous assurer que tout s' | ||
+ | |||
+ | |||
+ | |||
+ | **Since we have come this far, it is worth looking at how to modify the colors of the text. There are many ways of doing this, but, in my view, the easiest is to create a small text file in the /boot/grub folder from which GRUB can read your color choices. Type the following lines into this file: | ||
set color_normal=" | set color_normal=" | ||
Ligne 115: | Ligne 172: | ||
white | white | ||
- | This scheme will produce yellow text outside of the menu box with your image visible behind it; white text inside the menu box with the image visible behind it; and, black text with a light gray background for the highlighted entry. You can see that the colors are given as foreground (text)/ | + | This scheme will produce yellow text outside of the menu box with your image visible behind it; white text inside the menu box with the image visible behind it; and, black text with a light gray background for the highlighted entry. You can see that the colors are given as foreground (text)/ |
+ | |||
+ | Puisque nous sommes arrivés jusqu' | ||
+ | |||
+ | set color_normal=" | ||
+ | |||
+ | set menu_color_normal=" | ||
+ | |||
+ | set menu_color_highlight=" | ||
+ | |||
+ | et sauvegardez-le comme custom.cfg. Les couleurs disponibles sont : | ||
+ | vert | ||
+ | cyan | ||
+ | rouge | ||
+ | magenta | ||
+ | brun | ||
+ | gris clair | ||
+ | gris sombre | ||
+ | bleu clair | ||
+ | vert clair | ||
+ | cyan clair | ||
+ | rouge clair | ||
+ | magenta clair | ||
+ | jaune | ||
+ | blanc | ||
+ | |||
+ | Ce schéma donnera un texte jaune à l' | ||
+ | |||
+ | **For those of you who prefer a “works right out of the box experience”, | ||
+ | |||
+ | As is often the case in computing, trying to do one simple thing often leads you to learn about other things that you had no idea about. This is a case in point, but a successful outcome is always its own reward.** | ||
- | For those of you who prefer a “works right out of the box experience”, I have prepared a package of fonts of different sizes (GrubFont24.pf2 | + | Pour ceux d' |
- | As is often the case in computing, trying to do one simple | + | Comme c'est souvent le cas en informatique, des tentatives pour faire une chose simple |
issue170/tutoriel2.1624890520.txt.gz · Dernière modification : 2021/06/28 16:28 de auntiee