Migliorare l'aspetto dei font: differenze tra le versioni
(Aggiunta box informativi e commenti nei file di config.) |
m (→DPI) |
||
Riga 187: | Riga 187: | ||
Alcuni sostengono che il valore DPI da inserire nelle configurazioni deve essere arrotondato, senza parte decimale. Però il fatto che sia usato un valore ''double'' per memorizzare il DPI mi fa pensare che sia fatto apposta per usare anche la parte decimale. | Alcuni sostengono che il valore DPI da inserire nelle configurazioni deve essere arrotondato, senza parte decimale. Però il fatto che sia usato un valore ''double'' per memorizzare il DPI mi fa pensare che sia fatto apposta per usare anche la parte decimale. | ||
È consigliata la lettura di [https://lists.ubuntu.com/archives/ubuntu-desktop/2008-December/001887.html questo vecchio messaggio] per capire un po' meglio il ruolo dei DPI nel sistema operativo. | |||
=== KDE === | === KDE === | ||
Riga 194: | Riga 196: | ||
e aggiungere il valore DPI desiderato: | e aggiungere il valore DPI desiderato: | ||
<pre>ServerArgsLocal=-nolisten tcp -dpi 96</pre> | <pre>ServerArgsLocal=-nolisten tcp -dpi 96</pre> | ||
== Appendice == | == Appendice == |
Versione delle 01:03, 17 ott 2012
Versioni Compatibili Tutte le versioni supportate di Debian |
Introduzione
Stufo del rendering di Firefox, ho cercato un po' in giro ed ho trovato vari spunti per migliorare la resa dei caratteri sul nostro monitor LCD.
Configurazione fontconfig
Se assenti, cosa improbabile, installiamo queste tre librerie:
# apt-get install fontconfig libcairo2 libxft2
Apriamo un terminale con i permessi di root e diamo:
# dpkg-reconfigure fontconfig-config
e rispondiamo nell'ordine Nativo - Sempre - No
, poi possiamo dare:
# dpkg-reconfigure fontconfig
e dopo rigeneriamo la cache dei font con:
# fc-cache -fv $ fc-cache -fv
Ora, con i normali permessi utente, creiamo il file .fonts.conf
nella nostra home:
$ nano ~/.fonts.conf
ed inseriamo quanto segue:
<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig> <match target="font"> <!-- Font rasterization converts vector font data to bitmap data so that it can be displayed. The result can appear jagged due to aliasing. Anti-aliasing increases the apparent resolution of font edges. --> <edit mode="assign" name="antialias"> <bool>true</bool> </edit> <!-- Using normal hinting, TrueType hinting instructions in the font are interpreted by freetype's Byte-Code Interpreter. This works best for fonts with good hinting instructions. --> <edit mode="assign" name="hinting"> <bool>true</bool> </edit> <!-- Auto-discovery for hinting. This looks worse than normal hinting for fonts with good instructions, but better for those with poor or no instructions. The autohinter and subpixel rendering are not designed to work together and should not be used in combination. --> <edit mode="assign" name="autohint"> <bool>false</bool> </edit> <!-- Hint style is the amount of influence the hinting mode has. Hinting can be set to: "hintfull", "hintmedium", "hintslight" and "hintnone". With BCI hinting, "hintfull" should work best for most fonts. With the autohinter, "hintslight" is recommended. --> <edit mode="assign" name="hintstyle"> <const>hintslight</const> </edit> <!-- Subpixel rendering effectively triples the horizontal (or vertical) resolution for fonts by making use of subpixels. The autohinter and subpixel rendering are not designed to work together and should not be used in combination. Most monitors manufactured today use the Red, Green, Blue (RGB) specification. Fontconfig will need to know your monitor type to be able to display your fonts correctly. Values are "rgb" (most common), "bgr", "vrgb" (vertical), "vbgr", "unknown" or "none". --> <edit mode="assign" name="rgba"> <const>rgb</const> </edit> <!-- When using subpixel rendering, you should enable the LCD filter, which is designed to reduce colour fringing. The "lcddefault" filter will work for most users. Other filters are available that can be used in special situations: "lcdlight"; a lighter filter ideal for fonts that look too bold or fuzzy; "lcdlegacy", the original Cairo filter; "lcdnone" to disable it entirely. --> <edit mode="assign" name="lcdfilter"> <const>lcddefault</const> </edit> </match> <!-- Fontconfig should be able to detect DPI parameters as discovered by the Xorg server. You can check the automatically discovered DPI with the command xdpyinfo --> <!-- <match target="pattern"> <edit name="dpi" mode="assign"> <double>102</double> </edit> </match> --> </fontconfig>
Salviamo il file e riavviamo X facendo logout e login.
Nota Dalla versione 2.10 di fontconfig (non ancora disponibile in Debian al momento della scrittura di questa pagina) il file ~/.fonts.conf cambierà percorso, diventando ~/.config/fontconfig/fonts.conf (salvo cambiamenti da parte della Debian Fonts Task Force).
|
Suggerimento Se invece di salvare il file come ~/.fonts.conf lo si salva come /etc/fonts/local.conf i cambiamenti saranno applicati a tutto il sistema e non ad un solo utente
|
Preset fontconfig di Ubuntu
Se vi piace il font rendering di Ubuntu, possiamo copiarne le sue impostazioni. Quanto segue va eseguito in alternativa alla procedura descritta sopra.
Ubuntu usa il metodo di configurazione globale creando dei link simbolici delle configuzioni predefinite (contenute in /etc/fonts/conf.avail/
) dentro la directory che viene usata per impostare il rendering di fontconfig in assenza di impostazioni utente (ovvero /etc/fonts/conf.d/
). Sia le configurazioni predefinite che le impostazioni di partenza di Ubuntu sono diverse da quelle di Debian, motivo per cui i caratteri di Ubuntu già dal primo avvio hanno un bell'aspetto.
Per evitare "mix" tra le impostazioni di Ubuntu e quelle predefinite di Debian, disattiviamo queste ultime per sicurezza con:
# mv /etc/fonts/conf.d /etc/fonts/bak.conf.d
e assicuriamoci che non sia presente il file .fonts.conf
nella nostra home.
Ho riunito tutte le impostazioni contenute in /etc/fonts/conf.d/
di Ubuntu in un unico file. Basta creare il file /etc/fonts/conf.d/51-local.conf
con:
# mkdir /etc/fonts/conf.d # nano /etc/fonts/conf.d/51-local.conf
fare un copia-incolla e salvare. Il contenuto del file essendo abbastanza grande l'ho messo alla fine di questa pagina per non rovinare la leggibilità.
Fatto ciò dare i comandi:
# sudo dpkg-reconfigure fontconfig # fc-cache -fv $ fc-cache -fv
poi fare logout e login e già siamo a posto. Così facendo tutti gli utenti del sistema avranno questa configurazione, ma ognuno se vuole può usare ~/.fonts.conf
per cambiare la propria.
Se si vuole ancora più un "Ubuntu-style" si può scaricare la famiglia di caratteri Ubuntu, ed estrarre l'archivio in /usr/local/share/fonts
per mettere i font a disposizione di tutti gli utenti del sistema (se siete gelosi dei vostri font allora basta estrarli in ~/.fonts/
):
# unzip ubuntu-font-family-0.80.zip -d /usr/local/share/fonts/ # fc-cache -fv $ fc-cache -fv
Per ripristinare la configurazione di default di Debian:
# rm -R /etc/fonts/conf.d # mv /etc/fonts/bak.conf.d /etc/fonts/conf.d # dpkg-reconfigure fontconfig
ed eventualmente eseguire la configurazione classica.
Configurazione Xft
Alcune applicazioni ignorano le impostazioni sopra perché non supportano fontconfig. In questo caso possiamo intervenire con Xft (X FreeType interface library).
Se non si usa nessuna di queste applicazioni è consigliabile tralasciare questa procedura e lasciare soltanto la configurazione di fontconfig.
Creiamo o modifichiamo il file .Xresources
nella nostra home con:
$ nano ~/.Xresources
ed aggiungiamo quanto segue:
! You can define basic font resources without the need of a fonts.conf file ! or a desktop environment. Note however, the use of a desktop environment ! and/or fonts.conf can override these settings. ! Your best option is to use one or the other, but not both. Xft.antialias: 1 Xft.hinting: 1 Xft.autohint: 0 Xft.hintstyle: hintslight Xft.rgba: rgb Xft.lcdfilter: lcddefault ! Fontconfig will default to the Xft.dpi variable if it is set. ! Xft.dpi is usually set by desktop environments (usually to Xorg's DPI ! setting). Use "xrdb -query | grep dpi" to query for the value. ! Xft.dpi: 102
Salviamo il file e riavviamo X facendo logout e login.
Suggerimento Se invece del file ~/.Xresources si inseriscono queste opzioni in /etc/X11/Xresources/x11-common i cambiamenti saranno applicati a tutto il sistema e non ad un solo utente
|
DPI
Se non siamo ancora soddisfatti del risultato oppure il nostro monitor è grande e i caratteri sono piccoli, si può provare a cambiare il valore DPI dei caratteri usando quello del monitor (che sarebbe più corretto chiamare PPI).
Generalmente fontconfig ricava tale valore automaticamente da xorg oppure usa lo standard non ufficiale dei 96 DPI. Per trovare il valore del nostro monitor, bisogna trovare prima la diagonale in pixel (applicando il teorema di Pitagora alla risoluzione nativa dello schermo) e poi dividerla con la diagonale effettiva del monitor in pollici (generalmente si trova nelle specifiche del monitor).
Es.: il mio monitor è un AOC 2236Vw da 22" con risoluzione nativa di 1920x1080. Guardando le specifiche però trovo che la diagonale visibile non è 22" ma 21,5". Allora calcolo:
sqrt(1920^2 + 1080^2) / 21.5 = 102.46 PPI
Per fare più in fretta ci si può aiutare usando questo calcolatore.
Una volta trovato il valore DPI (o PPI) del monitor basta sostituirlo nelle righe commentate dei file .fonts.conf
e .Xresources
, togliendo ovviamente i commenti per abilitare.
Fate logout e login per vedere il risultato e se questo non è soddisfacente, commentate nuovamente le righe per tornare ai valori standard.
Alcuni sostengono che il valore DPI da inserire nelle configurazioni deve essere arrotondato, senza parte decimale. Però il fatto che sia usato un valore double per memorizzare il DPI mi fa pensare che sia fatto apposta per usare anche la parte decimale.
È consigliata la lettura di questo vecchio messaggio per capire un po' meglio il ruolo dei DPI nel sistema operativo.
KDE
Se, una volta avviato KDE, la dimensione dei caratteri è piccola, ciò è dovuto al fatto che KDM sta utilizzando di default i 75dpi.
Bisogna quindi modificare il file /etc/kde4/kdm/kdmrc
(o /usr/share/config/kdm/kdmrc
). Cercare la riga:
ServerArgsLocal=-nolisten tcp
e aggiungere il valore DPI desiderato:
ServerArgsLocal=-nolisten tcp -dpi 96
Appendice
Configurazione fontconfig di default di Ubuntu
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <!-- Use the Antialiasing --> <match target="font"> <edit name="antialias" mode="assign"><bool>true</bool></edit> </match> <!-- Use Hinting --> <match target="font"> <edit name="hinting" mode="assign"><bool>true</bool></edit> </match> <!-- Use Slight Hinting --> <match target="font"> <edit name="hintstyle" mode="assign"><const>hintslight</const></edit> </match> <!-- Use lcddefault as default for LCD filter --> <match target="font"> <edit mode="assign" name="lcdfilter"> <const>lcddefault</const> </edit> </match> <!-- Some Asian fonts misadvertise themselves as monospaced when in fact they are dual-spaced (half and full). This makes FreeType very confused as it forces all widths to match. Undo this magic by disabling the width forcing code --> <match target="font"> <test name="family"><string>GulimChe</string></test> <edit name="globaladvance"><bool>false</bool></edit> </match> <match target="font"> <test name="family"><string>DotumChe</string></test> <edit name="globaladvance"><bool>false</bool></edit> </match> <match target="font"> <test name="family"><string>BatangChe</string></test> <edit name="globaladvance"><bool>false</bool></edit> </match> <match target="font"> <test name="family"><string>GungsuhChe</string></test> <edit name="globaladvance"><bool>false</bool></edit> </match> <!-- The Bitstream Vera fonts have GASP entries suggesting that hinting be disabled below 8 ppem, but FreeType ignores those, preferring to use the data found in the instructed hints. The initial Vera release didn't include the right instructions in the 'prep' table. Fix this by disabling hinting manually at smaller sizes (< 8ppem) --> <match target="font"> <test name="family"> <string>Bitstream Vera Sans</string> </test> <test name="pixelsize" compare="less"> <double>7.5</double> </test> <edit name="hinting"> <bool>false</bool> </edit> </match> <match target="font"> <test name="family"> <string>Bitstream Vera Serif</string> </test> <test name="pixelsize" compare="less"> <double>7.5</double> </test> <edit name="hinting"> <bool>false</bool> </edit> </match> <match target="font"> <test name="family"> <string>Bitstream Vera Sans Mono</string> </test> <test name="pixelsize" compare="less"> <double>7.5</double> </test> <edit name="hinting"> <bool>false</bool> </edit> </match> <!-- Alias similar/metric-compatible families from various sources: PostScript fonts: Helvetica Times Courier URW fonts: Nimbus Sans L Nimbus Roman No9 L Nimbus Mono L Microsoft fonts: Arial Times New Roman Courier New Liberation fonts: Liberation Sans Liberation Serif Liberation Mono StarOffice fonts: Albany Thorndale Cumberland AMT fonts: Albany AMT Thorndale AMT Cumberland AMT Of these, URW fonts are design compatible with PostScrict fonts, and the Liberation, StarOffice, and AMT ones are compatible with Microsoft fonts. We want for each of them to fallback to any of these available, but in an order preferring similar designs first. We do this in three steps: 1) Alias each specific to it's generic family. eg. Liberation Sans to Arial 2) Weak alias each generic to the other generic of its family. eg. Arial to Helvetica 3) Alias each generic to its specifics. eg. Arial to Liberation Sans, Albany, and Albany AMT --> <!-- Map specifics to generics --> <!-- PostScript --> <alias binding="same"> <family>Nimbus Sans L</family> <default> <family>Helvetica</family> </default> </alias> <alias binding="same"> <family>Nimbus Roman No9 L</family> <default> <family>Times</family> </default> </alias> <alias binding="same"> <family>Nimbus Mono L</family> <default> <family>Courier</family> </default> </alias> <!-- Microsoft --> <alias binding="same"> <family>Liberation Sans</family> <family>Albany</family> <family>Albany AMT</family> <default> <family>Arial</family> </default> </alias> <alias binding="same"> <family>Liberation Serif</family> <family>Thorndale</family> <family>Thorndale AMT</family> <default> <family>Times New Roman</family> </default> </alias> <alias binding="same"> <family>Liberation Mono</family> <family>Cumberland</family> <family>Cumberland AMT</family> <default> <family>Courier New</family> </default> </alias> <!-- Accept the other group as fallback --> <!-- PostScript --> <alias> <family>Helvetica</family> <default> <family>Arial</family> </default> </alias> <alias> <family>Times</family> <default> <family>Times New Roman</family> </default> </alias> <alias> <family>Courier</family> <default> <family>Courier New</family> </default> </alias> <!-- Microsoft --> <alias> <family>Arial</family> <default> <family>Helvetica</family> </default> </alias> <alias> <family>Times New Roman</family> <default> <family>Times</family> </default> </alias> <alias> <family>Courier New</family> <default> <family>Courier</family> </default> </alias> <!-- Map generics to specifics --> <!-- PostScript --> <alias binding="same"> <family>Helvetica</family> <accept> <family>Nimbus Sans L</family> </accept> </alias> <alias binding="same"> <family>Times</family> <accept> <family>Nimbus Roman No9 L</family> </accept> </alias> <alias binding="same"> <family>Courier</family> <accept> <family>Nimbus Mono L</family> </accept> </alias> <!-- Microsoft --> <alias binding="same"> <family>Arial</family> <accept> <family>Liberation Sans</family> <family>Albany</family> <family>Albany AMT</family> </accept> </alias> <alias binding="same"> <family>Times New Roman</family> <accept> <family>Liberation Serif</family> <family>Thorndale</family> <family>Thorndale AMT</family> </accept> </alias> <alias binding="same"> <family>Courier New</family> <accept> <family>Liberation Mono</family> <family>Cumberland</family> <family>Cumberland AMT</family> </accept> </alias> <!-- URW provides metric and shape compatible fonts for some Adobe families. Helvetica, Courier, and Times are handled in 30-metric-aliases.conf --> <alias binding="same"> <family>Avant Garde</family> <accept><family>URW Gothic L</family></accept> </alias> <alias binding="same"> <family>Bookman</family> <accept><family>URW Bookman L</family></accept> </alias> <alias binding="same"> <family>New Century Schoolbook</family> <accept><family>Century Schoolbook L</family></accept> </alias> <alias binding="same"> <family>Palatino</family> <accept><family>URW Palladio L</family></accept> </alias> <alias binding="same"> <family>Zapf Chancery</family> <accept><family>URW Chancery L</family></accept> </alias> <alias binding="same"> <family>Zapf Dingbats</family> <accept><family>Dingbats</family></accept> </alias> <match target="pattern"> <test name="family"> <string>Symbol</string> </test> <edit name="family" mode="append" binding="same"> <string>Standard Symbols L</string> </edit> </match> <!-- Mark common families with their generics so we'll get something reasonable --> <!-- Serif faces --> <alias> <family>Nazli</family> <family>Lotoos</family> <family>Mitra</family> <family>Ferdosi</family> <family>Badr</family> <family>Zar</family> <family>Titr</family> <family>Jadid</family> <family>Kochi Mincho</family> <family>AR PL SungtiL GB</family> <family>AR PL Mingti2L Big5</family> <family>MS 明朝</family> <family>NanumMyeongjo</family> <family>UnBatang</family> <family>Baekmuk Batang</family> <family>MgOpen Canonica</family> <family>Sazanami Mincho</family> <family>AR PL ZenKai Uni</family> <family>ZYSong18030</family> <family>FreeSerif</family> <default><family>serif</family></default> </alias> <!-- Sans-serif faces --> <alias> <family>Arshia</family> <family>Elham</family> <family>Farnaz</family> <family>Nasim</family> <family>Sina</family> <family>Roya</family> <family>Koodak</family> <family>Terafik</family> <family>Kochi Gothic</family> <family>AR PL KaitiM GB</family> <family>AR PL KaitiM Big5</family> <family>MS ゴシック</family> <family>NanumGothic</family> <family>UnDotum</family> <family>Baekmuk Dotum</family> <family>Baekmuk Gulim</family> <family>SimSun</family> <family>MgOpen Modata</family> <family>MgOpen Moderna</family> <family>Sazanami Gothic</family> <family>AR PL ShanHeiSun Uni</family> <family>ZYSong18030</family> <family>FreeSans</family> <default><family>sans-serif</family></default> </alias> <!-- Monospace faces --> <alias> <family>NanumGothicCoding</family> <family>NSimSun</family> <family>ZYSong18030</family> <family>FreeMono</family> <default><family>monospace</family></default> </alias> <!-- Fantasy faces --> <alias> <family>Homa</family> <family>Kamran</family> <family>Fantezi</family> <family>Tabassom</family> <default><family>fantasy</family></default> </alias> <!-- Cursive faces --> <alias> <family>IranNastaliq</family> <family>Nafees Nastaleeq</family> <default><family>cursive</family></default> </alias> <!-- Mark common families with their generics so we'll get something reasonable --> <!-- Serif faces --> <alias> <family>Bitstream Vera Serif</family> <family>DejaVu Serif</family> <family>Liberation Serif</family> <family>Times New Roman</family> <family>Times</family> <family>Nimbus Roman No9 L</family> <family>Luxi Serif</family> <family>Thorndale AMT</family> <family>Thorndale</family> <default><family>serif</family></default> </alias> <!-- Sans-serif faces --> <alias> <family>Bitstream Vera Sans</family> <family>DejaVu Sans</family> <family>Liberation Sans</family> <family>Arial</family> <family>Helvetica</family> <family>Verdana</family> <family>Albany AMT</family> <family>Albany</family> <family>Nimbus Sans L</family> <family>Luxi Sans</family> <default><family>sans-serif</family></default> </alias> <!-- Monospace faces --> <alias> <family>Bitstream Vera Sans Mono</family> <family>DejaVu Sans Mono</family> <family>Liberation Mono</family> <family>Inconsolata</family> <family>Courier New</family> <family>Courier</family> <family>Andale Mono</family> <family>Luxi Mono</family> <family>Cumberland AMT</family> <family>Cumberland</family> <family>Nimbus Mono L</family> <default><family>monospace</family></default> </alias> <!-- Fantasy faces --> <alias> <family>Impact</family> <family>Copperplate Gothic Std</family> <family>Cooper Std</family> <family>Bauhaus Std</family> <default><family>fantasy</family></default> </alias> <!-- Cursive faces --> <alias> <family>ITC Zapf Chancery Std</family> <family>Zapfino</family> <family>Comic Sans MS</family> <default><family>cursive</family></default> </alias> <!-- If the font still has no generic name, add sans-serif --> <match target="pattern"> <test qual="all" name="family" compare="not_eq"> <string>sans-serif</string> </test> <test qual="all" name="family" compare="not_eq"> <string>serif</string> </test> <test qual="all" name="family" compare="not_eq"> <string>monospace</string> </test> <edit name="family" mode="append_last"> <string>sans-serif</string> </edit> </match> <!-- Load per-user customization file --> <include ignore_missing="yes">~/.fonts.conf.d</include> <include ignore_missing="yes">~/.fonts.conf</include> <!-- Load local system customization file --> <include ignore_missing="yes">local.conf</include> <!-- Use legacy LCD filter on smaller Monospace fonts --> <match target="font"> <test name="family"> <string>DejaVu Sans Mono</string> <string>Bitstream Vera Sans Mono</string> </test> <test name="pixelsize" compare="less_eq"> <double>12.0</double> </test> <edit name="lcd_filter" mode="assign"> <const>lcdlegacy</const> </edit> <edit name="hintstyle" mode="assign"> <const>hintfull</const> </edit> </match> <alias> <family>serif</family> <prefer> <family>DejaVu Serif</family> <family>Bitstream Vera Serif</family> <family>Times New Roman</family> <family>Thorndale AMT</family> <family>Luxi Serif</family> <family>Nimbus Roman No9 L</family> <family>Times</family> </prefer> </alias> <alias> <family>sans-serif</family> <prefer> <family>DejaVu Sans</family> <family>Bitstream Vera Sans</family> <family>Verdana</family> <family>Arial</family> <family>Albany AMT</family> <family>Luxi Sans</family> <family>Nimbus Sans L</family> <family>Helvetica</family> <family>Lucida Sans Unicode</family> <family>BPG Glaho International</family> <!-- lat,cyr,arab,geor --> <family>Tahoma</family> <!-- lat,cyr,greek,heb,arab,thai --> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>DejaVu Sans Mono</family> <family>Bitstream Vera Sans Mono</family> <family>Inconsolata</family> <family>Andale Mono</family> <family>Courier New</family> <family>Cumberland AMT</family> <family>Luxi Mono</family> <family>Nimbus Mono L</family> <family>Courier</family> </prefer> </alias> <!-- Fantasy faces --> <alias> <family>fantasy</family> <prefer> <family>Impact</family> <family>Copperplate Gothic Std</family> <family>Cooper Std</family> <family>Bauhaus Std</family> </prefer> </alias> <!-- Cursive faces --> <alias> <family>cursive</family> <prefer> <family>ITC Zapf Chancery Std</family> <family>Zapfino</family> <family>Comic Sans MS</family> </prefer> </alias> <!-- fonts-persian.conf To configure Persian fonts from The FarsiWeb Project. Copyright (C) 2005 Sharif FarsiWeb, Inc. <license@farsiweb.info> Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Sharif FarsiWeb, Inc. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Sharif FarsiWeb, Inc. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. SHARIF FARSIWEB, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ChangeLog: 2005-04-03 Behdad Esfahbod: Initial revision. 2005-10-09 Behdad Esfahbod: Turned off back-slant and Tahoma sections. 2005-11-30 Behdad Esfahbod: Set Titr susbtitution size to 24 points. 2008 Behdad Esfahbod: Cleanup. Add fantasy and cursive. --> <!-- Deprecated fonts are discouraged --> <!-- Nesf[2] is officially deprecated and has problematic tables --> <alias binding="same"> <family>Nesf</family> <accept><family>Nesf2</family></accept> </alias> <alias binding="same"> <family>Nesf2</family> <accept><family>Persian_sansserif_default</family></accept> </alias> <!-- Name changes and spelling variant aliases --> <alias binding="same"> <family>Nazanin</family> <accept><family>Nazli</family></accept> </alias> <alias binding="same"> <family>Lotus</family> <accept><family>Lotoos</family></accept> </alias> <alias binding="same"> <family>Yaqut</family> <accept><family>Yaghoot</family></accept> </alias> <alias binding="same"> <family>Yaghut</family> <accept><family>Yaghoot</family></accept> </alias> <alias binding="same"> <family>Traffic</family> <accept><family>Terafik</family></accept> </alias> <alias binding="same"> <family>Ferdowsi</family> <accept><family>Ferdosi</family></accept> </alias> <alias binding="same"> <family>Fantezy</family> <accept><family>Fantezi</family></accept> </alias> <!-- Classify fonts. --> <!-- Persian_title class --> <alias binding="same"> <family>Jadid</family> <accept><family>Persian_title</family></accept> </alias> <alias binding="same"> <family>Titr</family> <accept><family>Persian_title</family></accept> </alias> <!-- Persian_fantasy class --> <alias binding="same"> <family>Kamran</family> <accept> <family>Persian_fantasy</family> <family>Homa</family> </accept> </alias> <alias binding="same"> <family>Homa</family> <accept> <family>Persian_fantasy</family> <family>Kamran</family> </accept> </alias> <alias binding="same"> <family>Fantezi</family> <accept><family>Persian_fantasy</family></accept> </alias> <alias binding="same"> <family>Tabassom</family> <accept><family>Persian_fantasy</family></accept> </alias> <!-- Persian_square class --> <alias binding="same"> <family>Arshia</family> <accept><family>Persian_square</family></accept> </alias> <alias binding="same"> <family>Nasim</family> <accept><family>Persian_square</family></accept> </alias> <alias binding="same"> <family>Elham</family> <accept> <family>Persian_square</family> <family>Farnaz</family> </accept> </alias> <alias binding="same"> <family>Farnaz</family> <accept> <family>Persian_square</family> <family>Elham</family> </accept> </alias> <alias binding="same"> <family>Sina</family> <accept><family>Persian_square</family></accept> </alias> <!-- Font ordering per class --> <!-- Persian_title class --> <alias binding="same"> <family>Persian_title</family> <accept> <family>Titr</family> <family>Jadid</family> <family>Persian_serif</family> </accept> </alias> <!-- Persian_fantasy class --> <alias binding="same"> <family>Persian_fantasy</family> <accept> <family>Homa</family> <family>Kamran</family> <family>Fantezi</family> <family>Tabassom</family> <family>Persian_square</family> </accept> </alias> <!-- Persian_square class --> <alias binding="same"> <family>Persian_square</family> <accept> <family>Arshia</family> <family>Elham</family> <family>Farnaz</family> <family>Nasim</family> <family>Sina</family> <family>Persian_serif</family> </accept> </alias> <!-- Register the fonts that we actually do have --> <match target="scan"> <test name="family"> <string>Elham</string> </test> <edit name="foundry"> <string>farsiweb</string> </edit> </match> <match target="scan"> <test name="family"> <string>Homa</string> </test> <edit name="foundry"> <string>farsiweb</string> </edit> </match> <match target="scan"> <test name="family"> <string>Koodak</string> </test> <edit name="foundry"> <string>farsiweb</string> </edit> </match> <match target="scan"> <test name="family"> <string>Nazli</string> </test> <edit name="foundry"> <string>farsiweb</string> </edit> </match> <match target="scan"> <test name="family"> <string>Roya</string> </test> <edit name="foundry"> <string>farsiweb</string> </edit> </match> <match target="scan"> <test name="family"> <string>Terafik</string> </test> <edit name="foundry"> <string>farsiweb</string> </edit> </match> <match target="scan"> <test name="family"> <string>Titr</string> </test> <edit name="foundry"> <string>farsiweb</string> </edit> </match> <!-- Our fonts should oblique to the other side (TURNED-OFF) --> <match target="font"> <test name="foundry"> <!--string>farsiweb</string--> <string>TURNED-OFF</string> </test> <test name="foundry"> <string>farsiweb</string> </test> <!-- check to see if the font is roman --> <test name="slant"> <const>roman</const> </test> <!-- check to see if the pattern requested non-roman --> <test target="pattern" name="slant" compare="not_eq"> <const>roman</const> </test> <!-- multiply the matrix to slant the font --> <edit name="matrix" mode="assign"> <times> <name>matrix</name> <matrix><double>1</double><double>-0.2</double> <double>0</double><double>1</double> </matrix> </times> </edit> <!-- pretend the font is oblique now --> <edit name="slant" mode="assign"> <const>oblique</const> </edit> </match> <!-- We can't hint our fonts well, so turn off hinting. Moreover, the bitmaps we have designed (well, they have designed), suck, so disable them too. --> <match target="font"> <test name="foundry"> <string>farsiweb</string> </test> <edit name="autohint"> <bool>false</bool> </edit> <edit name="hinting"> <bool>false</bool> </edit> <edit name="embeddedbitmap"> <bool>false</bool> </edit> </match> <!-- Alias our fonts to common families --> <!-- Persian serif fonts --> <alias> <family>serif</family> <accept> <family>Nazli</family> <family>Lotoos</family> <family>Mitra</family> <family>Ferdosi</family> <family>Badr</family> <family>Zar</family> </accept> </alias> <!-- Persian sans-serif fonts --> <alias> <family>sans-serif</family> <accept> <family>Roya</family> <family>Koodak</family> <family>Terafik</family> </accept> </alias> <!-- Persian monospace fonts --> <alias> <family>monospace</family> <accept> <!-- Not really monospace --> <family>Terafik</family> </accept> </alias> <!-- Persian fantasy fonts --> <alias> <family>fantasy</family> <accept> <family>Homa</family> <family>Kamran</family> <family>Fantezi</family> <family>Tabassom</family> </accept> </alias> <!-- Persian (and Urdu) Nastaliq/cursive fonts --> <alias> <family>cursive</family> <accept> <family>IranNastaliq</family> <family>Nafees Nastaleeq</family> </accept> </alias> <!-- Use Titr in titles --> <!-- Both serif... --> <match> <test name="family"> <string>serif</string> </test> <test name="weight" compare="more_eq"> <int>200</int> </test> <test name="size" compare="more_eq"> <double>24</double> </test> <edit name="family" mode="prepend"> <string>Titr</string> </edit> </match> <!-- and sans-serif. --> <match> <test name="family"> <string>sans-serif</string> </test> <test name="weight" compare="more_eq"> <int>200</int> </test> <test name="size" compare="more_eq"> <double>24</double> </test> <edit name="family" mode="prepend"> <string>Titr</string> </edit> </match> <!-- and more. --> <match> <test name="family"> <string>Persian_sansserif_default</string> </test> <test name="weight" compare="more_eq"> <int>200</int> </test> <test name="size" compare="more_eq"> <double>24</double> </test> <edit name="family" mode="prepend" binding="same"> <string>Titr</string> </edit> </match> <!-- Default substituted for deprecated sans-serif fonts --> <match> <test name="family"> <string>Persian_sansserif_default</string> </test> <edit name="family" mode="assign" binding="same"> <string>Roya</string> </edit> </match> <alias> <family>serif</family> <prefer> <family>Artsounk</family> <!-- armenian --> <family>BPG UTF8 M</family> <!-- georgian --> <family>Kinnari</family> <!-- thai --> <family>Norasi</family> <!-- thai --> <family>Frank Ruehl</family> <!-- hebrew --> <family>Dror</family> <!-- hebrew --> <family>JG LaoTimes</family> <!-- lao --> <family>Saysettha Unicode</family> <!-- lao --> <family>Pigiarniq</family> <!-- canadian syllabics --> <family>B Davat</family> <!-- arabic (fa) --> <family>B Compset</family> <!-- arabic (fa) --> <family>Kacst-Qr</family> <!-- arabic (ar) --> <family>Urdu Nastaliq Unicode</family> <!-- arabic (ur) --> <family>Raghindi</family> <!-- devanagari --> <family>Mukti Narrow</family> <!-- bengali --> <family>malayalam</family> <!-- malayalam --> <family>Sampige</family> <!-- kannada --> <family>padmaa</family> <!-- gujarati --> <family>Hapax Berbère</family> <!-- tifinagh --> <family>MS Gothic</family> <!-- han (ja) --> <family>UmePlus P Gothic</family> <!-- han (ja) --> <family>SimSun</family> <!-- han (zh-cn,zh-tw) --> <family>PMingLiu</family> <!-- han (zh-tw) --> <family>WenQuanYi Zen Hei</family> <!-- han (zh-cn,zh-tw) --> <family>WenQuanYi Bitmap Song</family> <!-- han (zh-cn,zh-tw) --> <family>AR PL ShanHeiSun Uni</family> <!-- han (ja,zh-cn,zh-tw) --> <family>AR PL New Sung</family> <!-- han (zh-cn,zh-tw) --> <family>ZYSong18030</family> <!-- han (zh-cn,zh-tw) --> <family>HanyiSong</family> <!-- han (zh-cn,zh-tw) --> <family>MgOpen Canonica</family> <family>Sazanami Mincho</family> <family>IPAMonaMincho</family> <family>IPAMincho</family> <family>Kochi Mincho</family> <family>AR PL SungtiL GB</family> <family>AR PL Mingti2L Big5</family> <family>AR PL Zenkai Uni</family> <family>MS 明朝</family> <family>ZYSong18030</family> <family>NanumMyeongjo</family> <!-- hangul (ko) --> <family>UnBatang</family> <!-- hangul (ko) --> <family>Baekmuk Batang</family> <!-- hangul (ko) --> <family>KacstQura</family> <family>Frank Ruehl CLM</family> <family>Lohit Bengali</family> <family>Lohit Gujarati</family> <family>Lohit Hindi</family> <family>Lohit Marathi</family> <family>Lohit Maithili</family> <family>Lohit Kashmiri</family> <family>Lohit Konkani</family> <family>Lohit Nepali</family> <family>Lohit Sindhi</family> <family>Lohit Punjabi</family> <family>Lohit Tamil</family> <family>Meera</family> <family>Lohit Malayalam</family> <family>Lohit Kannada</family> <family>Lohit Telugu</family> <family>Lohit Oriya</family> <family>LKLUG</family> </prefer> </alias> <alias> <family>sans-serif</family> <prefer> <family>Nachlieli</family> <!-- hebrew --> <family>Lucida Sans Unicode</family> <family>Yudit Unicode</family> <family>Kerkis</family> <!-- greek --> <family>ArmNet Helvetica</family> <!-- armenian --> <family>Artsounk</family> <!-- armenian --> <family>BPG UTF8 M</family> <!-- georgian --> <family>Waree</family> <!-- thai --> <family>Loma</family> <!-- thai --> <family>Garuda</family> <!-- thai --> <family>Umpush</family> <!-- thai --> <family>Saysettha Unicode</family> <!-- lao? --> <family>JG Lao Old Arial</family> <!-- lao --> <family>GF Zemen Unicode</family> <!-- ethiopic --> <family>Pigiarniq</family> <!-- canadian syllabics --> <family>B Davat</family> <!-- arabic (fa) --> <family>B Compset</family> <!-- arabic (fa) --> <family>Kacst-Qr</family> <!-- arabic (ar) --> <family>Urdu Nastaliq Unicode</family> <!-- arabic (ur) --> <family>Raghindi</family> <!-- devanagari --> <family>Mukti Narrow</family> <!-- bengali --> <family>malayalam</family> <!-- malayalam --> <family>Sampige</family> <!-- kannada --> <family>padmaa</family> <!-- gujarati --> <family>Hapax Berbère</family> <!-- tifinagh --> <family>MS Gothic</family> <!-- han (ja) --> <family>UmePlus P Gothic</family> <!-- han (ja) --> <!-- chinese fonts are actually serifed --> <family>SimSun</family> <!-- han (zh-cn,zh-tw) --> <family>PMingLiu</family> <!-- han (zh-tw) --> <family>WenQuanYi Zen Hei</family> <!-- han (zh-cn,zh-tw) --> <family>WenQuanYi Bitmap Song</family> <!-- han (zh-cn,zh-tw) --> <family>AR PL ShanHeiSun Uni</family> <!--han (ja,zh-cn,zh-tw) --> <family>AR PL New Sung</family> <!-- han (zh-cn,zh-tw) --> <family>MgOpen Modata</family> <family>VL Gothic</family> <family>IPAMonaGothic</family> <family>IPAGothic</family> <family>Sazanami Gothic</family> <family>Kochi Gothic</family> <family>AR PL KaitiM GB</family> <family>AR PL KaitiM Big5</family> <family>AR PL ShanHeiSun Uni</family> <family>AR PL SungtiL GB</family> <family>AR PL Mingti2L Big5</family> <family>MS ゴシック</family> <family>ZYSong18030</family> <!-- han (zh-cn,zh-tw) --> <family>TSCu_Paranar</family> <!-- tamil --> <family>NanumGothic</family> <!-- hangul (ko) --> <family>UnDotum</family> <!-- hangul (ko) --> <family>Baekmuk Dotum</family> <!-- hangul (ko) --> <family>Baekmuk Gulim</family> <!-- hangul (ko) --> <family>KacstQura</family> <family>Lohit Bengali</family> <family>Lohit Gujarati</family> <family>Lohit Hindi</family> <family>Lohit Marathi</family> <family>Lohit Maithili</family> <family>Lohit Kashmiri</family> <family>Lohit Konkani</family> <family>Lohit Nepali</family> <family>Lohit Sindhi</family> <family>Lohit Punjabi</family> <family>Lohit Tamil</family> <family>Meera</family> <family>Lohit Malayalam</family> <family>Lohit Kannada</family> <family>Lohit Telugu</family> <family>Lohit Oriya</family> <family>LKLUG</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>Miriam Mono</family> <!-- hebrew --> <family>VL Gothic</family> <family>IPAMonaGothic</family> <family>IPAGothic</family> <family>Sazanami Gothic</family> <family>Kochi Gothic</family> <family>AR PL KaitiM GB</family> <family>MS Gothic</family> <!-- han (ja) --> <family>UmePlus Gothic</family> <!-- han (ja) --> <family>NSimSun</family> <!-- han (zh-cn,zh-tw) --> <family>MingLiu</family> <!-- han (zh-tw) --> <family>AR PL ShanHeiSun Uni</family> <!-- han (ja,zh-cn,zh-tw) --> <family>AR PL New Sung Mono</family> <!-- han (zh-cn,zh-tw) --> <family>HanyiSong</family> <!-- han (zh-cn) --> <family>AR PL SungtiL GB</family> <family>AR PL Mingti2L Big5</family> <family>ZYSong18030</family> <!-- han (zh-cn,zh-tw) --> <family>NanumGothicCoding</family> <!-- hangul (ko) --> <family>NanumGothic</family> <!-- hangul (ko) --> <family>UnDotum</family> <!-- hangul (ko) --> <family>Baekmuk Dotum</family> <!-- hangul (ko) --> <family>Baekmuk Gulim</family> <!-- hangul (ko) --> <family>TlwgTypo</family> <!-- thai --> <family>TlwgTypist</family> <!-- thai --> <family>TlwgTypewriter</family> <!-- thai --> <family>TlwgMono</family> <!-- thai --> <family>Hasida</family> <!-- hebrew --> <family>Mitra Mono</family> <!-- bengali --> <family>GF Zemen Unicode</family> <!-- ethiopic --> <family>Hapax Berbère</family> <!-- tifinagh --> <family>Lohit Bengali</family> <family>Lohit Gujarati</family> <family>Lohit Hindi</family> <family>Lohit Marathi</family> <family>Lohit Maithili</family> <family>Lohit Kashmiri</family> <family>Lohit Konkani</family> <family>Lohit Nepali</family> <family>Lohit Sindhi</family> <family>Lohit Punjabi</family> <family>Lohit Tamil</family> <family>Meera</family> <family>Lohit Malayalam</family> <family>Lohit Kannada</family> <family>Lohit Telugu</family> <family>Lohit Oriya</family> <family>LKLUG</family> </prefer> </alias> <alias> <family>serif</family> <prefer> <family>FreeSerif</family> <family>Code2000</family> <family>Code2001</family> <!-- plane1 and beyond --> </prefer> </alias> <alias> <family>sans-serif</family> <prefer> <family>FreeSans</family> <family>Arial Unicode MS</family> <family>Arial Unicode</family> <family>Code2000</family> <!-- almost everything; serif actually --> <family>Code2001</family> <!-- plane1 and beyond --> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>FreeMono</family> </prefer> </alias> <!-- Reject bitmap fonts --> <selectfont> <rejectfont> <pattern> <patelt name="scalable"><bool>false</bool></patelt> </pattern> </rejectfont> </selectfont> <!-- Fix-ups for Delicious family --> <!-- Delicious 'heavy' variant says its Medium weight --> <match target="scan"> <test name="family"> <string>Delicious</string> </test> <test name="style"> <string>Heavy</string> </test> <edit name="weight"> <const>heavy</const> </edit> </match> <!-- Artificial oblique for fonts without an italic or oblique version --> <match target="font"> <!-- check to see if the font is roman --> <test name="slant"> <const>roman</const> </test> <!-- check to see if the pattern requested non-roman --> <test target="pattern" name="slant" compare="not_eq"> <const>roman</const> </test> <!-- multiply the matrix to slant the font --> <edit name="matrix" mode="assign"> <times> <name>matrix</name> <matrix><double>1</double><double>0.2</double> <double>0</double><double>1</double> </matrix> </times> </edit> <!-- pretend the font is oblique now --> <edit name="slant" mode="assign"> <const>oblique</const> </edit> <!-- and disable embedded bitmaps for artificial oblique --> <edit name="embeddedbitmap" mode="assign"> <bool>false</bool> </edit> </match> <!-- Synthetic emboldening for fonts that do not have bold face available --> <match target="font"> <!-- check to see if the font is just regular --> <test name="weight" compare="less_eq"> <const>medium</const> </test> <!-- check to see if the pattern requests bold --> <test target="pattern" name="weight" compare="more"> <const>medium</const> </test> <!-- set the embolden flag needed for applications using cairo, e.g. gucharmap, gedit, ... --> <edit name="embolden" mode="assign"> <bool>true</bool> </edit> <!-- set weight to bold needed for applications using Xft directly, e.g. Firefox, ... --> <edit name="weight" mode="assign"> <const>bold</const> </edit> </match> </fontconfig>
Riferimenti
Per approfondimenti:
http://wiki.debian.org/Fonts
https://wiki.archlinux.org/index.php/Font_Configuration
http://www.freedesktop.org/software/fontconfig/fontconfig-user.html
http://www.keithp.com/~keithp/render/Xft.tutorial
https://en.wikipedia.org/wiki/Pixels_per_inch
http://weirdfellow.wordpress.com/2010/07/25/valid-autohinting-hinting-style-options/
http://duganchen.ca/writings/slackware/fonts/