Fonte

Font.

Besoin

Définir un variante de police.

Analyse

Les variations d'une police sont caractérisées par :

Implémentation

Utilisation Taille Style Création
CSS <strong>font:</strong>15<strong>px arial,sans-serif;<br> <br> font:italic bold </strong>12<strong>px/</strong>30<strong>px Georgia, serif;</strong>
@font-face {
  font-family: 'IconicFill';
  src: url("iconic/iconic_fill.eot");
  src: url("iconic/iconic_fill.eot?#iefix") format("embedded-opentype"), url("iconic_fill.ttf") format("truetype"), url("iconic/iconic_fill.svg#iconic") format("svg");
  font-weight: normal;
  font-style: normal; }
<strong> font-family</strong>: TellePolice;<br> <br> <span class="deprecated"><strong>font-size:</strong> 10<strong>px</strong>;</span><br> <strong>font-size:</strong> 2.5<strong>em</strong>; <strong>font-style: normal</strong>|<strong>italic</strong>|<strong>oblique</strong>;
HTML <font <strong>face</strong>=<span class="codeString">"TellePolice"</span>>
Javascript object.style.font=<span class="codeString">"italic small-caps bold 12px arial,sans-serif"</span>
Java <strong>Font</strong> someFont = new java.awt.<strong>Font</strong>(<span class="codeString">"TellePolice"</span>, telleGraisse, telleTaille);<br> someGraphics.<strong>setFont</strong>(someFont);<br> <br> Font myFont = Font.<strong>createFont</strong>(<strong>Font.TRUETYPE_FONT</strong>, new File(<span class="codeString">"myFont.TTF"</span>));
someFont.<strong>deriveFont</strong>(20f);

Exemples

Un exemple de feuille de style CSS est :

<strong><style type=</strong><span class="codeString">"text/css"</span>><br> <br> .mainTitle
        <strong>{</strong> <strong> <span class="codeComment">// class</span><br> font-family</strong>: Verdana, Arial,
        Helvetica, sans-serif; <strong><br> font-size: larger</strong><br> }<br> <br> h1 { <br>
        <strong>font-family</strong>: <span class="codeString">"Bookman Old
  Style"</span>; <strong><br> font-size: x-large; <br> font-style: normal; <br> font-weight: normal; <br>
            font-variant: normal; </strong><strong><br> }</strong><br> <br> p { <strong><br> font-size: small; <br>
            font-style: normal; <br> color:</strong> #000000; <strong><br>
            font-family:</strong> <span class="codeString">"Bookman
  Old Style"</span>; <strong><br> </strong><strong>}</strong><br> <br> address <strong>{ <br> font-family:</strong> <span class="codeString">"Courier
  New"</span>, Courier, mono; <strong><br> font-size: small; <br> </strong><strong>}</strong><br> <strong></style></strong>
    

Java :

someGraphics.<strong>setFont</strong>(new java.awt.<strong>Font</strong>(<span class="codeString">"Courier"</span>, Font.BOLD, 36));

Un exemple de page Web (HTML) utilisant une feuille de style est :

   <h1>Ce titre 1 est bleu</h1><br> <p <strong>style=<span class="codeString">"color:
green"</span></strong>>Alors que ce paragraphe est vert.

Références