| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function svg_getTTFont { |
| |
| local -a FONT_PATTERNS |
| local FONT_PATTERN='' |
| local FONT_FILE='' |
| |
| |
| FONT_PATTERNS[((++${#FONT_PATTERNS[*]}))]="/${1}\.ttf$" |
| FONT_PATTERNS[((++${#FONT_PATTERNS[*]}))]="sans\.ttf$" |
| FONT_PATTERNS[((++${#FONT_PATTERNS[*]}))]="\.ttf$" |
| |
| |
| |
| local FONT_DIR='/usr/share/fonts' |
| |
| |
| local FONT_FILES=$(cli_getFilesList ${FONT_DIR} --pattern="^.+\.ttf$") |
| |
| |
| |
| |
| for FONT_PATTERN in ${FONT_PATTERNS[@]};do |
| |
| FONT_FILE=$(echo "$FONT_FILES" | egrep ${FONT_PATTERN} \ |
| | head -n 1) |
| |
| if [[ -f $FONT_FILE ]];then |
| break |
| fi |
| |
| done |
| |
| |
| if [[ -f $FONT_FILE ]];then |
| echo $FONT_FILE |
| else |
| cli_printMessage "`gettext "The font provided doesn't exist."`" --as-error-line |
| fi |
| |
| } |
| |