Skip to content

Commit

Permalink
Allow local font names to be missing
Browse files Browse the repository at this point in the history
  • Loading branch information
dpeukert authored and neverpanic committed Jun 20, 2020
1 parent b084434 commit bb4ffec
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions google-font-download
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,10 @@ for family in "${families[@]}"; do

# Determine the local names for the given fonts so we can use a locally-installed font if available.
css_src_string=$(echo "$css_string" | grep "src:")
ret=0
local_name=$(echo "$css_src_string" | grep -Eo "src: local\\('[^']+'\\)," | $ESED "s/^src: local\\('([^']+)'\\),$/\\1/g") || ret=$?
if [ $ret -ne 0 ]; then
errors=1
printf >&2 "Failed to determine local font name\\n"
fi
local_name=$(echo "$css_src_string" | grep -Eo "src: local\\('[^']+'\\)," | $ESED "s/^src: local\\('([^']+)'\\),$/\\1/g") || true
local_postscript_name=$(echo "$css_src_string" | grep -Eo ", local\\('[^']+'\\)," | $ESED "s/^, local\\('([^']+)'\\),$/\\1/g") || true

# When the local font name couldn't be determined, still produce a valid CSS file
# Some fonts don't have a local font name
if [ -n "$local_name" ]; then
printf >>"$css" "\\t\\tlocal('%s'),\\n" "$local_name"
fi
Expand Down

0 comments on commit bb4ffec

Please sign in to comment.