Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/buildfonts #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.log
# ignore fonts source files:
source-code-pro
debian/fonts-source-code-pro*
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## About

Debian package for the Adobe font Source Code Pro (or anything Debian based). This one pulls the fonts sources from [here](https://github.com/adobe-fonts/source-code-pro) and builds them.


## Requirements

1. Adobe's AFDKO for GNU/Linux (specifically, makeotf)
* can be obtained from: http://www.adobe.com/devnet/opentype/afdko.html
1. `dpkg-dev` package
* install by running: `sudo apt-get install dpkg-dev`

## Installation:

1. Clone this repo, and cd to its directory
1. Run: `./runme.sh`
1. Get one directory up, and install the `.deb` file from there.

Binary file removed SourceCodePro-Black.otf
Binary file not shown.
Binary file removed SourceCodePro-Bold.otf
Binary file not shown.
Binary file removed SourceCodePro-ExtraLight.otf
Binary file not shown.
Binary file removed SourceCodePro-Light.otf
Binary file not shown.
Binary file removed SourceCodePro-Regular.otf
Binary file not shown.
Binary file removed SourceCodePro-Semibold.otf
Binary file not shown.
2 changes: 1 addition & 1 deletion debian/install
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.otf usr/share/fonts/opentype/sourcecodepro
source-code-pro/target/OTF/*.otf usr/share/fonts/opentype/sourcecodepro
*.conf etc/fonts/conf.avail
119 changes: 119 additions & 0 deletions runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/bin/sh
url='[email protected]:adobe-fonts/source-code-pro.git'
afdko_home="http://www.adobe.com/devnet/opentype/afdko"
s="$( echo ${url} | cut -d'/' -f2 | cut -d. -f1 )"

binary_prompt_yn() {
### usage:
## binary_prompt_yn <yes> <no> <default> <dont exit on this> <message>
y=$1
shift 1
n=$1
shift 1
default_resp=$1
shift 1
dont_exit_on=$1
shift 1
prompt_msg="$*"
defaults="["
if [ "${default_resp}" = "${y}" ]; then
defaults="${defaults}$( echo $y | tr [:lower:] [:upper:] )/${n}"
else
defaults="${defaults}$y/$( echo $n | tr [:lower:] [:upper:] )"
fi
defaults="${defaults}]"
read -p "${prompt_msg} ${defaults}? " x
if [ -z "${x}" ]; then
x="${default_resp}"
fi
resp="$( echo $x | tr [:upper:] [:lower:] | cut -c1 )"
if [ "${dont_exit_on}" != "${resp}" ]; then
echo "Exiting par user request."
exit 0
fi
}

show_intent() {
echo "This script will:"
/bin/echo -e "\t1. download latest adobe fonts sources"
/bin/echo -e "\t2. build them with AFDKO (must be installed)"
/bin/echo -e "\t3. create a Debian package for them"
/bin/echo -e "\t4. (optional) install the created package"
}

check_tools() {
echo "#######################################"
echo "Checking tools..."
echo "#######################################"
which makeotf 2> /dev/null 1> /dev/null
if [ ! $? -eq 0 ]; then
echo "Error: makeotf is not found"
echo "Hint: To obtain, browse to the page: ${afdko_home}"
exit 1
fi
which dpkg-buildpackage 2> /dev/null 1> /dev/null
if [ ! $? -eq 0 ]; then
echo "Error: dpkg-buildpackage is not found."
echo "Hint: to intall, run: sudo apt-get install dpkg-dev"
exit 1
fi
}

fetch_fonts_source () {
echo "#######################################"
echo "Fetching latest source for Fonts from: ${url}"
echo "#######################################"
if [ -d "${s}" ]; then
rm -fr ${s}
fi
cmd="git clone ${url}"
$cmd
if [ $? -ne 0 ]; then
echo "Error occurred when running: ${cmd}"
exit 1
fi
}

build_fonts() {
echo "#######################################"
echo "Building Fonts ..."
echo "#######################################"
fbuildlog="$(pwd)/${s}.build.log"
test -f ${fbuildlog} && rm -f ${fbuildlog}
cd ${s}
./build.sh 2>&1 | tee ${fbuildlog}
if [ $? -ne 0 ]; then
echo "Something went wrong during the build of the fonts."
echo "Inspect ${fbuildlog} file!"
exit 1
fi
cd ../
trg="${s}/target/OTF"
echo "#######################################"
echo "The Fonts are ready under: ${trg}"
echo "#######################################"
}

build_package () {
echo "#######################################"
echo "Building Debian package ..."
echo "#######################################"
dpkg-buildpackage
}

main() {
show_intent
# fetch official github sources for the fonts:
binary_prompt_yn "y" "n" "n" "y" "Do you want to continue"
check_tools
fetch_fonts_source
build_fonts
build_package
echo "#######################################"
echo "DONE"
echo "#######################################"
exit $?
}


main