2 # Process fc query output to collect font file data
6 # Where to save fc-query data
9 # FIXME: only extracts info about the first typeface in a TTC file for now
10 parse_localized_fc_query() {
13 fieldstring=$(awk -F ':' -v field="$field" \
14 '$1 == "\t"field { print $2 ; exit }' "$file" \
15 | sed 's="(s)="=g' | sed 's=" *"=|=g'| sed 's= *" *==g')"|"
16 default=$(echo $fieldstring | awk -F "|" '{ print $1 }')
17 if $(grep -q "^"$'\t'$field"lang:" "$file") ; then
18 langstring=$(awk -F ':' -v field="$field" \
19 '$1 == "\t"field"lang" { print $2 ; exit }' "$file" \
20 | sed 's="(s)="=g' | sed 's=" *"=|=g'| sed 's= *" *==g')"|"
21 # Try to find the English label
22 while [ "$langstring" != "" -a \
23 "$(echo $langstring | cut -d '|' -f 1)" != "en" ] ; do
24 fieldstring=$(echo "$fieldstring" | sed 's+\([^|]*\)|\(.*\)+\2+g')
25 langstring=$(echo "$langstring" | sed 's+\([^|]*\)|\(.*\)+\2+g')
27 # We could hide problems by reporting the first label regardless of its
28 # language. But this is an audit script — we do not hide problems
29 echo "$fieldstring" | awk -F "|" '{ print $1 }'
31 echo $(echo $fieldstring | cut -d '|' -f 1)
35 if $(FC_DEBUG=256 fc-query "$font_file" 2> /dev/null > "$fc_file") ; then
36 family=$(parse_localized_fc_query family "$fc_file")
37 style=$(parse_localized_fc_query style "$fc_file")
38 format=$(parse_localized_fc_query fontformat "$fc_file")
44 echo "$family|$style|$format"