1. Yad Font
Display font selection dialog
Command
yad --font
Figure 1. Font dialog
Output in the terminal
Sans 10
If you were to select the Bold Style the output looks like
Sans Bold 10
1.1. --fontname=FONTNAME
Set the initial font.
FONTNAME
is a string with font representation in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]"
.
1.2. --preview=TEXT
Set text string for preview.
Command
yad --preview="This is the preview text"
Figure 2. Font dialog with a custom preview
1.3. --separate-output
Separate output of font description.
Command
yad --font --separate-output
The result output is
Sans|Bold Italic|10
1.4. --separator=STRING
Set output separator character.
Default separator is |
.
1.5. --quoted-output
Output data will be in shell-style quotes.
Command
yad --font --quoted-output
Figure 3. Font dialog with qouted output
The result output is
'Sans Bold Italic 10'
1.6. Tips
To pass the three, (Family, Style, Size) separately, you need to do something like this:
Code
#!/bin/sh
yad --font | while read line; do
# Might need to add more styles.
STL=$(echo $line | grep -o "Bold\|Italic\|Oblique\|Condensed\|Medium")
STYLE=$(echo $STL)
SIZE=$(echo $line | awk '{print $NF}')
if [ "$STYLE" = "" ]; then
NAME=`echo $line | awk -F"$SIZE" '{print $1}'`
else
NAME=`echo $line | awk -F"$STYLE" '{print $1}'`
fi
echo $NAME
echo $STYLE
echo $SIZE
done