I try to make a font preferences setting in fvwm-crystal. The code look like this:
[code]DestroyMenu /Preferences
- ‘%22x22/fvwm-crystal/user-desktop.png%$[gt.Characters fonts]’ Popup /Preferences/Fonts
DestroyMenu /Preferences/Fonts
AddToMenu /Preferences/Fonts
- MissingSubmenuFunction Fonts-generator
- ‘%22x22/fvwm-crystal/user-desktop.png%$[gt.Panels]’ Popup Panel
- ‘%22x22/fvwm-crystal/user-desktop.png%$[gt.Title bar]’ Popup Title
DestroyFunc Fonts-generator
AddToFunc Fonts-generator
- I DestroyMenu recreate $0
- I AddToMenu $0
- I PipeRead ‘fc-list | sed -e ‘s/\(:style=[[:alpha:]]\) ./\1/’ -e ‘s/\(:style=[[:alpha:]]\),./\1/’ -e ‘s/\(,.\):\(style=.\)/\2/’ -e ‘s/style=//’ | sort > $[FVWM_USERDIR]/FontList;
while read myline ; do echo “AddToMenu $0 ‘${myline}’ $0Font-Set ‘${myline}’”; done < $[FVWM_USERDIR]/FontList;’
DestroyFunc PanelFont-Set
AddToFunc PanelFont-Set
- I SavePreferences PanelFont “SetEnv panel_font \”"$*"\""
- I Style * Font “xft:$:pixelsize=12:Bold"
Test (EnvIsSet FVWM_FLAG_UTF-8) + I Style * Font "xft:$:pixelsize=12:Bold:encoding=iso10646-1”
DestroyFunc TitleFont-Set
AddToFunc TitleFont-Set
- I SavePreferences TitleFont “SetEnv title_font \”"$*"\""
- I Style * Font “xft:$0:pixelsize=12:Bold”
Test (EnvIsSet FVWM_FLAG_UTF-8) + I Style * Font “xft:$0:pixelsize=12:Bold:encoding=iso10646-1”
[/code]
When the menu is called and a submenu Panel or Title is called, the Fonts-generator function create the file $[FVWM_USERDIR]/FontList and the corresponding submenu with the entries form this file. When a font is clicked in this submenu, a preference setting is written into PanelFont or TitleFont and the font is applied to the titlebar (In both cases, I will do the panel when the titlebar will work).
The only thing that doesn’t work is that the font is not applied when it is some space in its name. It look like only the part of the fontname before the first space is send. as example, “Bitstream Cyberbit:Roman” is saved correctly into the Title or Panel pref file, but only “Bitstream” is send to the style.
$[FVWM_USERDIR]/FontList look like:
Aerial:Bold
Aerial:Italic
Aerial Mono:Bold
...
For the Bitsrteam Cyberbit, the Panel or Title pref file will look like:
SetEnv title_font "Bitstream Cyberbit:Roman"
The same non working fonts are working fine at restart with this 2 lines into the theme file:
Style * Font "xft:$[title_font]:pixelsize=14:Bold"
Test (EnvIsSet FVWM_FLAG_UTF-8) Style * Font "xft:$[title_font]:pixelsize=14:Bold:encoding=iso10646-1"
I suspect a quoting issue but is completely lost after spending a lot of time to try to make it to work.