libi3/font: Use "pango:" prefix to avoid confusion

Also add a user-friendly font description syntax to userguide
This commit is contained in:
Quentin Glidic 2012-11-07 09:54:17 +01:00 committed by Michael Stapelberg
parent 783fd66b58
commit f0d2d84b1c
4 changed files with 14 additions and 8 deletions

View File

@ -316,13 +316,15 @@ and fall back to a working font.
*Syntax*: *Syntax*:
------------------------------ ------------------------------
font <X core font description> font <X core font description>
font xft:<a FreeType font description> font pango:[family list] [style options] [size]
------------------------------ ------------------------------
*Examples*: *Examples*:
-------------------------------------------------------------- --------------------------------------------------------------
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 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]] [[keybindings]]
@ -1117,7 +1119,7 @@ font <font>
-------------------------------------------------------------- --------------------------------------------------------------
bar { bar {
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 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
} }
-------------------------------------------------------------- --------------------------------------------------------------

View File

@ -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 # 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 # 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 # right-to-left text rendering, you should instead use pango for rendering and
# chose an xft font, such as: # chose a FreeType font, such as:
# font xft:DejaVu Sans Mono 10 # font pango:DejaVu Sans Mono 10
# use Mouse+Mod1 to drag floating windows to their wanted position # use Mouse+Mod1 to drag floating windows to their wanted position
floating_modifier Mod1 floating_modifier Mod1

View File

@ -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 # 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 # 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 # right-to-left text rendering, you should instead use pango for rendering and
# chose an xft font, such as: # chose a FreeType font, such as:
# font xft:DejaVu Sans Mono 10 # font pango:DejaVu Sans Mono 10
# Use Mouse+$mod to drag floating windows to their wanted position # Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod floating_modifier $mod

View File

@ -142,7 +142,11 @@ i3Font load_font(const char *pattern, const bool fallback) {
#if PANGO_SUPPORT #if PANGO_SUPPORT
/* Try to load a pango font if specified */ /* 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:"); pattern += strlen("xft:");
if (load_pango_font(&font, pattern)) if (load_pango_font(&font, pattern))
return font; return font;