Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
issue170:tutoriel2 [2021/06/29 12:56] – [3] auntiee | issue170:tutoriel2 [2021/06/30 16:12] (Version actuelle) – andre_domenech |
---|
===== 1 ===== | |
| |
**One of the many great features of Ubuntu is its ability to be installed alongside other operating systems like Windows, or different versions of Linux. The GRUB boot menu that is displayed allows you to pick the OS to boot from, and, although it is certainly functional, it is not very aesthetically appealing. (Note: It is not possible to capture the boot screen since no OS is running, so I have created these screens to look like the real thing; however, there may be small differences). | **One of the many great features of Ubuntu is its ability to be installed alongside other operating systems like Windows, or different versions of Linux. The GRUB boot menu that is displayed allows you to pick the OS to boot from, and, although it is certainly functional, it is not very aesthetically appealing. (Note: It is not possible to capture the boot screen since no OS is running, so I have created these screens to look like the real thing; however, there may be small differences). |
| |
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'Ubuntu est sa capacité à être installé à côté d'autres systèmes d'exploitation, comme Windows ou différentes version de Linux. Le menu boot de GRUB qui s'affiche vous permet de choisir l'OS que vous voulez démarrer et, bien qu'il soit certainement fonctionnel, ce n'est pas très attrayant esthétiquement. (Nota : il n'est pas possible de faire un capture d'écran de l'écran de boot, car aucun OS ne s'exécute ; aussi, j'ai créé ces écrans pour qu'ils ressemblent au vrai. Toutefois, il peut y avoir de petites différences). | L'une des très nombreuses caractéristiques géniales d'Ubuntu est sa capacité à être installé à côté d'autres systèmes d'exploitation, comme Windows ou différentes version de Linux. Le menu boot de GRUB qui s'affiche vous permet de choisir l'OS que vous voulez démarrer et, bien qu'il soit certainement fonctionnel, ce n'est pas très attrayant esthétiquement. (Nota : il n'est pas possible de faire une capture de l'écran de boot, car aucun OS ne s'exécute ; aussi, j'ai créé ces écrans pour qu'ils ressemblent au vrai. Toutefois, il peut y avoir de petites différences.) |
| |
J'ai décidé de peaufiner l'aspect de l'écran de boot en ajoutant une image en arrière-plan. Cet article décrit mes expériences en ce faisant et relate les divers problèmes que j'ai rencontrés et les solutions que j'ai trouvées en cours de route. | |
| |
Le manuel de GRUB donne des détails de ce procédure, mais il y a essentiellement 3 étapes : | J'ai décidé de peaufiner l'aspect de l'écran de boot en ajoutant une image en arrière-plan. Cet article décrit mes expériences en le faisant et relate les divers problèmes que j'ai rencontrés et les solutions que j'ai trouvées en cours de route. |
| |
===== 2 ===== | 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://newevolutiondesigns.com/75-free-hd-abstract-backgrounds. You also need to make sure it is the correct size for your screen, I used 1366 x 768 as this is the preferred resolution of my laptop. If you want to use an image of your own that is not the correct size, it can easily be resized with GIMP. Call this image Back.png (or some other suitable name), and put it in the /boot/grub folder. You will need administrator privileges to do this, so right-click and select Open as Administrator before you try to Paste. If your Ubuntu version does not have this feature, just run your file manager with sudo which will give you the access you need. | **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://newevolutiondesigns.com/75-free-hd-abstract-backgrounds. You also need to make sure it is the correct size for your screen, I used 1366 x 768 as this is the preferred resolution of my laptop. If you want to use an image of your own that is not the correct size, it can easily be resized with GIMP. Call this image Back.png (or some other suitable name), and put it in the /boot/grub folder. You will need administrator privileges to do this, so right-click and select Open as Administrator before you try to Paste. If your Ubuntu version does not have this feature, just run your file manager with sudo which will give you the access you need. |
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. Récupérez une image à utiliser - elle doit être en 256 couleurs RGB non-indexées et, de préférance, en format PNG. Vous pouvez télécharger des images d'arrière-plan gratuites sur plein de sites et j'ai obtenu le mien sur https://newevolutiondesigns.com/75-free-hd-abstract-backgrounds. Vous devez également vous assurer que ce soit la bonne taille pour votre écran et j'ai utilisé 1366 x 768, car c'est la meilleure résolution de mon portable. Si vous voulez utiliser une de vos propres images qui n'est pas de la bonne taille, vous pouvez facilement la redimensionner avec GIMP. Appelez cette image Back.png (ou un autre nom convenable) et mettez-la dans le dossier /boot/grub. Vous aurez besoin des privilèges d'administrateur, mais il suffit de faire un clique droit sur le dossier et sélectionner Ouvrir en tant qu'administrateur avant d'essayer de la coller. Si votre version d'Ubuntu n'a pas cette fonction, il suffit de lancer votre gestionnaire de fichiers avec sudo, ce qui vous donnera l'accès dont vous avez besoin. | 1. Récupérez une image à utiliser - elle doit être en 256 couleurs RGB non-indexées et, de préférence, en format PNG. Vous pouvez télécharger des images d'arrière-plan gratuites sur plein de sites et j'ai obtenu le mien sur https://newevolutiondesigns.com/75-free-hd-abstract-backgrounds. Vous devez également vous assurer que ce soit la bonne taille pour votre écran et j'ai utilisé 1366 x 768, car c'est la meilleure résolution de mon portable. Si vous voulez utiliser une de vos propres images qui n'est pas de la bonne taille, vous pouvez facilement la redimensionner avec GIMP. Appelez cette image Back.png (ou un autre nom convenable) et mettez-la dans le dossier /boot/grub. Vous aurez besoin des privilèges d'administrateur, mais il suffit de faire un clic droit sur le dossier et sélectionner Ouvrir en tant qu'administrateur avant d'essayer de la coller. Si votre version d'Ubuntu n'a pas cette fonction, il suffit de lancer votre gestionnaire de fichiers avec sudo, ce qui vous donnera l'accès dont vous avez besoin. |
| |
En tant d'administrateur, éditez le fichier /etc/default/grub et ajoutez les lignes suivantes à la fin du fichier : | En tant d'administrateur, éditez le fichier /etc/default/grub et ajoutez les lignes suivantes à la fin du fichier : |
GRUB_GFXMODE="1366x768x32" | GRUB_GFXMODE="1366x768x32" |
| |
Si une autre commande GRUB-GFXMODE est déjà dans le fichier, il suffit d'ajouter un # au début de la ligne pour la commenter. Cette dernière commande règle le mode graphique de votre écran ; cela doit être l'un des modes qui sont supporté ou la commande sera ignorée. (Si vous êtes incertain à propos de votre écran, démarrez le système jusqu'au menu GRUB puis appuyez rapidement sur la touche « c » pour qu'une invite grub > s'affiche. Tapez videoinfo et une liste de tous les modes vidéo disponibles paraîtra. Ensuite, appuyez sur la touche échap pour revenir au menu boot et continuer). | Si une autre commande GRUB-GFXMODE est déjà dans le fichier, il suffit d'ajouter un # au début de la ligne pour la commenter. Cette dernière commande règle le mode graphique de votre écran ; cela doit être l'un des modes qui sont supportés ou la commande sera ignorée. (Si vous êtes indécis à propos de votre écran, démarrez le système jusqu'au menu GRUB puis appuyez rapidement sur la touche « c » pour qu'une invite grub > s'affiche. Tapez videoinfo et une liste de tous les modes vidéo disponibles apparaîtra. Ensuite, appuyez sur la touche échap pour revenir au menu boot et continuer.) |
| |
3. Ouvrez un terminal et tapez : | 3. Ouvrez un terminal et tapez : |
sudo update-grub | sudo update-grub |
| |
pour créer un nouveau fichier de configuration de GRUB qui réflète ce changement. vous devriez voir que la mise à jour trouve l'image d'arrière-plan et se termine sans erreur. Redémarrez ! | pour créer un nouveau fichier de configuration de GRUB qui reflète ce changement. vous devriez voir que la mise à jour trouve l'image d'arrière-plan et se termine sans erreur. Redémarrez ! |
| |
===== 3 ===== | |
| |
| |
grub-mkfont -s 24 -o UbuntuMono.pf2 UbuntuMono-R.ttf** | grub-mkfont -s 24 -o UbuntuMono.pf2 UbuntuMono-R.ttf** |
| |
Eh beh, l'arrière-plan s'affiche, c'est sûr (en haut, page suivante), mais la police est plutôt petite et, sur un écran qui fait 1920 x 1080, cet effet est encore plus prononcé. La raison en est assez simple : GRUB utilise une résolution par défaut de 640 x 480 (mode texte) et utilise une police bitmap qui convient à cette résolution. Quand vous changez la résolution à 1366 x 768, les pixels sont plus petits et c'est pour quoi la taille de la police affichée est réduite. GRUB ne fournit qu'une seule police pour son utilisation (il s'agit de unifont.pf2 dans le dossier grub) ; aussi, si vous voulez quelque chose de plus grand, vous devez utiliser une police tout à fait différente, qui peut être mise à l'échelle convenablement. | Eh bien, l'arrière-plan s'affiche, c'est sûr (en haut, page suivante), mais la police est plutôt petite et, sur un écran qui fait 1920 x 1080, cet effet est encore plus prononcé. La raison en est assez simple : GRUB utilise une résolution par défaut de 640 x 480 (mode texte) et utilise une police bitmap qui convient à cette résolution. Quand vous changez la résolution à 1366 x 768, les pixels sont plus petits et c'est pour quoi la taille de la police affichée est réduite. GRUB ne fournit qu'une seule police pour son utilisation (il s'agit de unifont.pf2 dans le dossier grub) ; aussi, si vous voulez quelque chose de plus grand, vous devez utiliser une police tout à fait différente, qui peut être mise à l'échelle convenablement. |
| |
Heureusement, GRUB fournit un utilitaire commode uniquement à cette fin. Ainsi, no pouvez utilisée n'importe quelle police à chasse fixe et la convertir au format pf2 qui est nécessaire à GRUB. Vous avez beaucoup de polices sur votre système déjà et nous allons en utiliser une. Copier le fichier suivant : | Heureusement, GRUB fournit un utilitaire commode uniquement à cette fin. Ainsi, no pouvez utiliser n'importe quelle police à chasse fixe et la convertir au format pf2 qui est nécessaire à GRUB. Vous avez déjà beaucoup de polices sur votre système et nous allons en utiliser une. Copiez le fichier suivant : |
| |
/usr/share/fonts/truetype/Ubuntu/UbuntuMono-R.ttf | /usr/share/fonts/truetype/Ubuntu/UbuntuMono-R.ttf |
| |
grub-mkfont -s 24 -o UbuntuMono.pf2 UbuntuMono-R.ttf | grub-mkfont -s 24 -o UbuntuMono.pf2 UbuntuMono-R.ttf |
| |
===== 4 ===== | |
| |
| |
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.** |
| |
L'option -s 24 règle la taille et l'option -o est suivie par le nom du fichier de sortie. Cette commande fournit un fichier bitmap pour l'utilisation de GRUB qui est plus grand et devrait donc s'afficher mieux. Copiez le fichier UbuntuMono.pf2 sur votre bureau dans le dossier /boot/grub/fonts. Enfin, éditez (en tant qu'administrateur) le fichier /etc/default/grub à nouveau en ajoutant la ligne suivante à la fin : | L'option -s 24 règle la taille et l'option -o est suivie par le nom du fichier de sortie. Cette commande fournit un fichier bitmap pour l'utilisation de GRUB qui est plus grand et devrait donc s'afficher mieux. Copiez le fichier UbuntuMono.pf2 de votre bureau dans le dossier /boot/grub/fonts. Enfin, éditez (en tant qu'administrateur) le fichier /etc/default/grub à nouveau en ajoutant la ligne suivante à la fin : |
| |
GRUB_FONT="/boot/grub/fonts/UbuntuMono.pf2" | GRUB_FONT="/boot/grub/fonts/UbuntuMono.pf2" |
puis redémarrer pour voir son effet sur le menu boot de GRUB (voir en bas à gauche). | 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 la boîte n'est pas dessinée correctement. | La police est Ubuntu Mono et elle est d'une taille convenable, mais le cadre n'est pas dessiné correctement. |
| |
===== 5 ===== | |
| |
**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 | **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 |
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://terminus-font.sourceforge.net/. Click on All files toward the bottom of the page and download: terminus-font-4.49.1.tar.gz** | 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://terminus-font.sourceforge.net/. Click on All files toward the bottom of the page and download: terminus-font-4.49.1.tar.gz** |
| |
===== 6 ===== | 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 : |
| |
| /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf |
| |
| 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'affichage (ci-dessous). Ce résultat est presque ce que nous voulons, mais le cadre a encore des trous ; ainsi, on sait que quelque chose n'est pas tout à fait comme il faut. |
| |
| Essayons une toute dernière police pour voir ce qui se passe. Cette fois-ci, j'utiliserai une police appelée Terminus, qui est disponible au téléchargement ici : http://terminus-font.sourceforge.net/. Cliquez sur View all files (Voir tous les fichiers) vers le bas de la page et téléchargez : terminus-font-4.49.1.tar.gz |
| |
**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 |
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.** |
| |
===== 7 ===== | Décompressez l'archive dans votre dossier Téléchargements et ouvrez le dossier terminus-font-4.49 pour voir les fichiers de polices à l'intérieur. Vous remarquerez que le dossier contient un nombre de tailles différentes de police dans standard et gras, ce qui en fait une police bitmap qui est très flexible à l'utilisation. Copiez le fichier ter-u24b.bdf sur votre bureau ; il s'agit de la version de 24 points en gras de la police. La raison pour laquelle j'ai choisi cette police sera évidente d'ici un moment ; pour l'instant, suivez la séquence des étapes ci-dessus en changeant le nom des fichiers au besoin, pour inciter GRUB à se servir de cette police. Redémarrez et regardez le produit final (en bas à gauche). |
| |
| 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'étapes et les problèmes qui se sont présentés nous aident à comprendre ce qui se passe ici et à appréhender ce que nous avons fait. D'abord, GRUB ne comprend que les fichiers de police pf2, un format bitmap spécial créé spécifiquement pour GRUB. L'utilitaire grub-mkfont prend des polices Truetype (qui sont définies par des contours), les redimensionne et convertit la police Truetype originale au format bitmap pf2. Supposez que vous avez une grille 12 x 24 et vous y dessinez le contour d'une lettre. Certains des pixels sur la bordure seront partiellement à l'intérieur de la lettre et partiellement à l'extérieur ; aussi, il faut que l'ordinateur décide d'inclure ou d'exclure ces pixels-là. L'ordinateur fait un assez bon travail, mais le processus engendre quelques inexactitudes et le résultat peut contenir des pixels supplémentaires où vous ne les voulez pas ou des pixels manquants, là où vous les voulez. |
| |
| |
**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, it passed through the conversion process without any distortions and the final result is perfect. The Ubuntu font is a different story. The font as installed does not have characters for drawing a thick box so it substitutes the question mark character for the missing glyphs. | **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, it passed through the conversion process without any distortions and the final result is perfect. The Ubuntu font is a different story. The font as installed does not have characters for drawing a thick box so it substitutes the question mark character for the missing glyphs. |
If you select File > Import > OpenType Font and then navigate to /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf, and select this file, the font will be converted into bitmap format as it is imported. Choose 24 as the point size and 72 as the horizontal and vertical resolution.** | If you select File > Import > OpenType Font and then navigate to /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf, and select this file, the font will be converted into bitmap format as it is imported. Choose 24 as the point size and 72 as the horizontal and vertical resolution.** |
| |
===== 8 ===== | 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, le processus de conversion ne l'a pas du tout déformé et le résultat final est parfait. La police Ubuntu est une autre paire de manches. Telle qu'elle a été installée, la police n'a pas de caractères pour dessiner une boîte épaisse et elle substitue donc le caractère de point d'interrogation aux glyphes manquantes. |
| |
| 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'exercice ; et, puisque Terminus est disponible dans une variété de tailles, il est possible de choisir une taille qui est à votre goût. Et, parce que les caractères sont tous dessinés à partir de zéro plutôt qu'être redimensionnés, leur apparence à tous est fantastique. Cependant, si vraiment vous préférez un autre style de police, il y a une solution assez simple au problème de la déformation des polices par grub-mkfont. Il s'agit d'un programme appelé gbdfed qui fera la conversion d'une police Truetype en un fichier de police BDF modifiable. Après la correction de tout problème engendré par la conversion au format bitmap, grub-mkfont peut être utilisé sur cette police BDF ajustée pour produire une police pf2 qui fonctionne comme il faudrait. Vous pouvez installer gbdfed avec Synaptic, le Centre de logiciels ou apt-get, selon vos préférences. Vous pouvez en créer un lanceur sur le bureau ou appuyer sur Alt-F2 pour l'exécuter s'il n'apparaît pas dans votre menu ou dash. |
| |
| Si vous sélectionnez Fichier > Importer > Police OpenType puis naviguez vers /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf et sélectionnez ce fichier, la police sera convertie au format bitmap pendant son importation. Choisissez 24 comme taille de point et 72 pour la résolution horizontale et verticale. |
| |
**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 "i" seems thicker than the other characters. Double clicking on it will open an editing window where you can left-click to add pixels and right-click to remove them. In this case the red area shows the pixels that need to be removed. You might also choose to remove 2 pixels on the base line so it is balanced. When the letter is to your liking, select File → Update so that your changes will be written to the font file. When you are satisfied, select File → Save As, and save the file on your Desktop with a BDF extension. Personal taste is the final judge; if you like it, it’s correct. | **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 "i" seems thicker than the other characters. Double clicking on it will open an editing window where you can left-click to add pixels and right-click to remove them. In this case the red area shows the pixels that need to be removed. You might also choose to remove 2 pixels on the base line so it is balanced. When the letter is to your liking, select File → Update so that your changes will be written to the font file. When you are satisfied, select File → Save As, and save the file on your Desktop with a BDF extension. Personal taste is the final judge; if you like it, it’s correct. |
| |
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 "repaired" bitmap font that can be converted with grub-mkfont for use with GRUB. | 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 "repaired" bitmap font that can be converted with grub-mkfont for use with GRUB. |
| |
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.** | 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.** |
| |
===== 9 ===== | 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'autre (E, H, P et U) et le « i » semble plus épais que les autres caractères. Double-cliquez dessus et une fenêtre d'édition s'ouvrira dans laquelle vous pouvez faire un clic gauche pour ajouter des pixels et un clic droit pour les enlever. Dans ce cas, la zone rouge montre les pixels qui doivent être enlevés. Vous pourrez également choisir de supprimer 2 pixels sur la ligne de base pour qu'elle soit équilibrée. Quand le caractère vous plaît, sélectionnez Fichier -> Mettre à jour pour que vos modifications soient écrites dans le fichier de la police. Quand vous êtes satisfait, sélectionnez Fichier -> Enregistrer sous... et sauvegardez le fichier sur votre bureau avec l'extension BDF. C'est votre goût personnel qui doit être juge : si cela vous plaît, c'est comme il faut. |
| |
| 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, ce qui explique pourquoi le cadre qui était dessiné sur le menu boot de GRUB avait des trous. Tout ce qui est nécessaire est d'y mettre les pixels manquants pour que les caractères aillent jusqu'aux bords du cadre. Les carrés rouges montrent où il faut ajouter des pixels. De façon similaire, les coins doivent être ajustés pour qu'ils atteignent à la fois les limites horizontales et verticales. Répétez le processus pour les 3 autres caractères. Une fois que les six caractères ont été ajustés, sauvegardez le fichier à nouveau et vous avez maintenant une police bitmap « réparée » qui peut être convertie avec grub-mkfont pour être utilisée avec GRUB. |
| |
| 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'aligne avec les coins et les barres horizontales et verticales. De plus, les caractères pour les flèches vers le haut (2191) et vers le bas (2193) sont souvent manquantes et il faudra sans doute les ajouter aussi. |
| |
| |
**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: | **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: |
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)/background, but, if black is used as a background color, it actually means a transparent background so you can still see your image. Finally, there is no need to update grub after creating or modifying this file as it will get picked up automatically on boot.** | 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)/background, but, if black is used as a background color, it actually means a transparent background so you can still see your image. Finally, there is no need to update grub after creating or modifying this file as it will get picked up automatically on boot.** |
| |
===== 10 ===== | Puisque nous sommes arrivés jusqu'ici, ça vaut le coup de regarder comment modifier les couleurs du texte. Cela peut se faire de beaucoup de façons, mais, à mon avis, la plus facile est de créer un petit fichier texte dans le dossier /boot/grub où GRUB peut lire vos choix de couleur. Tapez les lignes suivantes dans ce fichier : |
| |
| set color_normal="yellow/black" |
| |
| set menu_color_normal="white/black" |
| |
| set menu_color_highlight="black/light-gray" |
| |
| 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'extérieur du cadre du menu avec votre image visible en arrière-plan, un texte blanc à l'intérieur du cadre du menu avec l'image visible en arrière plan et un texte noir avec un arrière-plan gris pour l'entrée qui est surlignée. Vous pouvez voir que les couleurs sont données comme premier plan (ou texte)/arrière-plan, mais, si on utilise noir pour la couleur de l'arrière-plan, l'arrière-plan sera en fait transparent et vous pouvez toujours voir l'image. Dernière chose, vous n'avez pas besoin de mettre grub à jour après la création ou la modification de ce fichier, car il sera récupéré automatiquement lors du démarrage. |
| |
**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 and GrubFont28.pf2), and enhanced line-spacing (GrubFont24s.pf2 and GrubFont28s.pf2). Although they are optimal for 1366x768 (24 px size) and 1920×1080 (28 px size) screen resolutions, they will work well with resolutions on either side of these benchmarks. They were created by modifying freely distributable fonts from GNU Intlfonts, with the addition of the box drawing characters, up and down arrows, and correct single quotation marks. The 28 px font was resized from a smaller 7×14 font, and then hand smoothed to produce a very crisp display on high resolution screens. They contain only the Latin alphabet and other characters as noted above, which is all that GRUB requires, so the files are extremely small. If you are interested, drop me an email and I will send you the set of 4 fonts, in pf2 format, so no conversion is required to use them in GRUB. | **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 and GrubFont28.pf2), and enhanced line-spacing (GrubFont24s.pf2 and GrubFont28s.pf2). Although they are optimal for 1366x768 (24 px size) and 1920×1080 (28 px size) screen resolutions, they will work well with resolutions on either side of these benchmarks. They were created by modifying freely distributable fonts from GNU Intlfonts, with the addition of the box drawing characters, up and down arrows, and correct single quotation marks. The 28 px font was resized from a smaller 7×14 font, and then hand smoothed to produce a very crisp display on high resolution screens. They contain only the Latin alphabet and other characters as noted above, which is all that GRUB requires, so the files are extremely small. If you are interested, drop me an email and I will send you the set of 4 fonts, in pf2 format, so no conversion is required to use them in GRUB. |
| |
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.** | 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.** |
| |
| Pour ceux d'entre vous qui préférez une expérience « dès le déballage », j'ai préparé un paquet de polices de tailles différentes (GrubFont24.pf2 et GrubFont28.pf2) et avec une espacement des lignes amélioré (GrubFont24s.pf2 et GrubFont28s.pf2). Bien que ces polices soient optimales pour les résolutions de 1366 x 768 (taille 24 px) et 1920 x 1080 (taille 28 px), elles fonctionneront bien avec des résolutions de chaque côté de ces résolutions standard. Elle ont été créées en modifiant des polices libres et gratuites venant de GNU Intlfonts, avec l'ajout des caractères qui dessinent les cadres, les flèches vers le haut et vers le bas et des apostrophes correctes. La police de 28 px a été redimensionnée à partir d'une police plus petite (7 x 14), puis lissée à la main pour produire un affichage très net sur des écrans à haute résolution. Les fichiers ne contiennent que l'alphabet latin et les autres caractères signalés ci-dessus, ce qui est tout ce qui est nécessaire pour GRUB, et les fichiers sont très petits. Si cela vous intéresse, envoyez-moi un courriel et je vous enverrai l'ensemble des 4 polices, en format pf2, que vous pourrez utiliser dans GRUB sans conversion. |
| |
| Comme c'est souvent le cas en informatique, des tentatives pour faire une chose simple vous mènent souvent à en apprendre beaucoup sur d'autres choses dont vous ne connaissiez rien. Ce cas-ci est un bon exemple, mais un bon résultat est toujours sa propre récompense. |
| |