From: Quentin Glidic Date: Wed, 7 Nov 2012 08:54:17 +0000 (+0100) Subject: libi3/font: Use "pango:" prefix to avoid confusion X-Git-Tag: 4.4~38 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f0d2d84b1c7168341466352eb72d0796fba91fa6;p=i3%2Fi3 libi3/font: Use "pango:" prefix to avoid confusion Also add a user-friendly font description syntax to userguide --- diff --git a/docs/userguide b/docs/userguide index f78b4913..99fb072c 100644 --- a/docs/userguide +++ b/docs/userguide @@ -316,13 +316,15 @@ and fall back to a working font. *Syntax*: ------------------------------ font -font xft: +font pango:[family list] [style options] [size] ------------------------------ *Examples*: -------------------------------------------------------------- font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -font xft:DejaVu Sans Mono 10 +font pango:DejaVu Sans Mono 10 +font pango:DejaVu Sans Mono, Terminus Bold Semi-Condensed 11 +font pango:Terminus 11x -------------------------------------------------------------- [[keybindings]] @@ -1117,7 +1119,7 @@ font -------------------------------------------------------------- bar { font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 - font xft:DejaVu Sans Mono 10 + font pango:DejaVu Sans Mono 10 } -------------------------------------------------------------- diff --git a/i3.config b/i3.config index e45b31ba..05ffb8f8 100644 --- a/i3.config +++ b/i3.config @@ -15,8 +15,8 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # The font above is very space-efficient, that is, it looks good, sharp and # clear in small sizes. However, if you need a lot of unicode glyphs or # right-to-left text rendering, you should instead use pango for rendering and -# chose an xft font, such as: -# font xft:DejaVu Sans Mono 10 +# chose a FreeType font, such as: +# font pango:DejaVu Sans Mono 10 # use Mouse+Mod1 to drag floating windows to their wanted position floating_modifier Mod1 diff --git a/i3.config.keycodes b/i3.config.keycodes index 890afcb7..21229208 100644 --- a/i3.config.keycodes +++ b/i3.config.keycodes @@ -16,8 +16,8 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # The font above is very space-efficient, that is, it looks good, sharp and # clear in small sizes. However, if you need a lot of unicode glyphs or # right-to-left text rendering, you should instead use pango for rendering and -# chose an xft font, such as: -# font xft:DejaVu Sans Mono 10 +# chose a FreeType font, such as: +# font pango:DejaVu Sans Mono 10 # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod diff --git a/libi3/font.c b/libi3/font.c index 23d7420d..a2162c47 100644 --- a/libi3/font.c +++ b/libi3/font.c @@ -142,7 +142,11 @@ i3Font load_font(const char *pattern, const bool fallback) { #if PANGO_SUPPORT /* Try to load a pango font if specified */ - if (strlen(pattern) > strlen("xft:") && !strncmp(pattern, "xft:", strlen("xft:"))) { + if (strlen(pattern) > strlen("pango:") && !strncmp(pattern, "pango:", strlen("pango:"))) { + pattern += strlen("pango:"); + if (load_pango_font(&font, pattern)) + return font; + } else if (strlen(pattern) > strlen("xft:") && !strncmp(pattern, "xft:", strlen("xft:"))) { pattern += strlen("xft:"); if (load_pango_font(&font, pattern)) return font;