Skip to content

Commit

Permalink
Install Nerd Fonts to separate folders
Browse files Browse the repository at this point in the history
  • Loading branch information
leouieda committed Sep 13, 2024
1 parent 2089e91 commit 056a8b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
29 changes: 18 additions & 11 deletions bash/.bash/functions/fonts.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
# Dowload and install Nerd Fonts https://www.nerdfonts.com

nerdfonts() {
if [[ $# -le 0 ]]; then
echo "Usage: nerdfonts FontName"
echo ""
echo "The name should be the package in the nerdfonts release page: https://github.com/ryanoasis/nerd-fonts/releases/latest"
else
wget -P ~/.local/share/fonts https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$1.zip \
&& cd ~/.local/share/fonts \
&& unzip $1.zip \
&& rm $1.zip \
&& fc-cache -fv
cd -
read -r -d '' NERDFONTS_HELP <<-'EOF'
Usage: nerdfonts FontName
Download a Nerd Font and install it locally.
The FontName should be the package in the nerdfonts release page:
https://github.com/ryanoasis/nerd-fonts/releases/latest
EOF
if [[ $# -ne 1 ]]; then
echo "$NERDFONTS_HELP"
return 1;
fi
outdir="$HOME/.local/share/fonts/$1"
baseurl="https://github.com/ryanoasis/nerd-fonts/releases/latest/download"
wget -P $outdir $baseurl/$1.zip \
&& unzip $outdir/$1.zip -d $outdir \
&& rm $outdir/$1.zip \
&& fc-cache -fv
}
10 changes: 6 additions & 4 deletions bash/.bash/functions/pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ pdfcmyk() {

pdfcompress() {
read -r -d '' PDFCOMPRESS_HELP <<-'EOF'
Usage: pdfcompress [INPUT] [OUTPUT]
Usage: pdfcompress [LEVEL] INPUT OUTPUT
Use Ghostscript to lower the DPI of images in a PDF.
LEVEL should be one of: screen [default], default, ebook, printer, prepress
EOF
if [[ $# == 0 ]]; then
if [[ $# -le 1 ]]; then
echo "$PDFCOMPRESS_HELP";
return 0;
return 1;
fi
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \
-dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages \
-dCompressFonts=true -sOutputFile=$2 $1
}
Expand Down

0 comments on commit 056a8b8

Please sign in to comment.