diff --git a/Makefile b/Makefile index 148ca66fa..326f8f581 100644 --- a/Makefile +++ b/Makefile @@ -134,7 +134,7 @@ compressed: $(ALL_COMPRESSED_FILES) check_compress_tool: ifdef MISSING_ZOPFLI ifdef MISSING_OPTIPNG - $(error "neither $(ZOPFLIPNG) nor $(OPTIPNG) is available") + $(error "neither $(ZOPFLIPNG) nor $(OPTIPNG) is available. For installation instructions, see README.md") else @echo "using $(OPTIPNG)" endif @@ -197,6 +197,11 @@ else @$(ZOPFLIPNG) -y "$<" "$@" 1> /dev/null 2>&1 endif +check-virtual-env: +ifeq (${VIRTUAL_ENV},) + @echo Please start your virtual environment, and run: "'pip install -r requirements.txt'". + @false +endif # Make 3.81 can endless loop here if the target is missing but no # prerequisite is updated and make has been invoked with -j, e.g.: @@ -214,7 +219,7 @@ endif @rm -f "$@" ttx "$<" -$(EMOJI).ttf: $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ +$(EMOJI).ttf: check-virtual-env $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ $(ALL_COMPRESSED_FILES) | check_vs_adder @$(PYTHON) $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" @$(PYTHON) $(PUA_ADDER) "$@" "$@-with-pua" diff --git a/README.md b/README.md index 1883dd933..6943d49b8 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,29 @@ # Noto Emoji Color and Black-and-White Noto emoji fonts, and tools for working with them. +## Prerequisites +Building Noto Color Emoji requires: +- Python 3 +- [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) +- [pngquant](https://pngquant.org/) +- Either [zopflipng](https://github.com/google/zopfli) or [optipng](http://optipng.sourceforge.net/). Zopflipng is better (about 5-10%) but much slower. + ## Building NotoColorEmoji +This project uses a virtual environment to manage dependencies. Use the following steps to get up and running. -Building NotoColorEmoji currently requires a Python 2.x wide build. To build -the emoji font you will require a few files from nototools. Clone a copy from -https://github.com/googlei18n/nototools and either put it in your PYTHONPATH or -use 'python setup.py develop' ('install' currently won't fully install all the -data used by nototools). You will also need fontTools, get it from -https://github.com/behdad/fonttools.git. +Create a virtual environment called `noto-emoji-env`: -Then run make. NotoColorEmoji is the default target. It's suggested to use -j, + python3 -m venv noto-emoji-env + +Activate the virtual environment: + + source noto-emoji-env/bin/activate + +Install the Python requirements with: + + pip install -r requirements.txt + +Then run `make`. NotoColorEmoji is the default target. It's suggested to use -j, especially if you are using zopflipng for compression. Intermediate products (compressed image files, for example) will be put into a build subdirectory; the font will be at the top level. diff --git a/add_emoji_gsub.py b/add_emoji_gsub.py index 9f578a302..9f1c40366 100755 --- a/add_emoji_gsub.py +++ b/add_emoji_gsub.py @@ -18,13 +18,11 @@ __author__ = "roozbeh@google.com (Roozbeh Pournader)" - import sys from fontTools import agl -from fontTools import ttLib from fontTools.ttLib.tables import otTables - +from fontTools import ttLib from nototools import font_data diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..9748ccfa8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fonttools>=4.7.0 +-e git://github.com/googlefonts/nototools.git#egg=master \ No newline at end of file