Table des matières

Polices pour développeur

Quand on travaille de nombreuses heures sur du code, il est important de mettre toutes les chances de son coté pour se faciliter la vie. Ça commence pas l'utilisation d'une police appropriée qui évitera les confusions et améliorera la lisibilité.

Avec une mauvaise police, il y a des risques de mauvaise lecture du code, par exemple en confondant :

Les différentes polices sont testées avec l'échantillon de code suivant 1) :

public function getElementValue(array $collection, string $index): ?int
{
    /** Comment #1 */
    if (empty($collection)) {
        return null;
    }
 
    // Comment #2
    foreach ($collection as $key => $element) {
        if ($key < $index || $key > $index) {
            echo 'Index does not match key', PHP_EOL;
            continue;
        }
 
        return $element->value();
    }
}

Fira Code

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789.:,;(){}[]<>|^/*!?`'“@#$%&_-+=~
àÀâÂçÇéÉèÈêÊëËîÎïÏôÔùÙûÛüÜæÆœŒ
The quick brown fox jumps over the lazy dog
== === != !== >= <= -> <=> =>
0O 1l B8 <> [] {} 2N2N2N2N

public function getElementValue(array $collection, string $index): ?int { /** Comment #1 */ if (empty($collection)) { return null; } // Comment #2 foreach ($collection as $key => $element) { if ($key < $index || $key > $index) { echo 'Index does not match key', PHP_EOL; continue; } return $element->value(); } }

  • La police est directement disponible dans les dépôts de Arch Linux.
  • La police supporte les ligatures.

Intel One Mono

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789.:,;(){}[]<>|^/*!?`'”@#$%&_-+=~
àÀâÂçÇéÉèÈêÊëËîÎïÏôÔùÙûÛüÜæÆœŒ
The quick brown fox jumps over the lazy dog
== === != !== >= <= -> <=> =>
0O 1l B8 <> [] {} 2N2N2N2N

public function getElementValue(array $collection, string $index): ?int { /** Comment #1 */ if (empty($collection)) { return null; } // Comment #2 foreach ($collection as $key => $element) { if ($key < $index || $key > $index) { echo 'Index does not match key', PHP_EOL; continue; } return $element->value(); } }

Iosevka

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789.:,;(){}[]<>|^/*!?`'“@#$%&_-+=~
àÀâÂçÇéÉèÈêÊëËîÎïÏôÔùÙûÛüÜæÆœŒ
The quick brown fox jumps over the lazy dog
== === != !== >= <= -> <=> =>
0O 1l B8 <> [] {} 2N2N2N2N

public function getElementValue(array $collection, string $index): ?int { /** Comment #1 */ if (empty($collection)) { return null; } // Comment #2 foreach ($collection as $key => $element) { if ($key < $index || $key > $index) { echo 'Index does not match key', PHP_EOL; continue; } return $element->value(); } }

  • La police supporte les ligatures.
  • La police vient en différentes variantes, il va falloir chercher un peu pour trouver celle qui convient.

JetBrains Mono

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789.:,;(){}[]<>|^/*!?`'”@#$%&_-+=~
àÀâÂçÇéÉèÈêÊëËîÎïÏôÔùÙûÛüÜæÆœŒ
The quick brown fox jumps over the lazy dog
== === != !== >= <= -> <=> =>
0O 1l B8 <> [] {} 2N2N2N2N

public function getElementValue(array $collection, string $index): ?int { /** Comment #1 */ if (empty($collection)) { return null; } // Comment #2 foreach ($collection as $key => $element) { if ($key < $index || $key > $index) { echo 'Index does not match key', PHP_EOL; continue; } return $element->value(); } }

  • La police supporte les ligatures 2).
  • La police supporte plusieurs langues, plusieurs langages, plusieurs graisses.

Liens

  1. Programming Fonts - Test Drive → pour tester d'autres polices pour développeur
1)
en plus de l'échantillon de texte défini ici
2)
Il existe une version sans ligature pour utiliser avec les outils n'ayant pas l'option pour les désactiver