Skip to content

Commit

Permalink
make: Build 1.0-alpha
Browse files Browse the repository at this point in the history
Uses much of the code/config from the the Emoji One Color font.
Seems to work correctly, but needs further testing.
  • Loading branch information
13rac1 committed Mar 11, 2016
1 parent 6e97f57 commit 04d4551
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
*.html linguist-vendored
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
build
SCFBuild
79 changes: 79 additions & 0 deletions Makefile
@@ -0,0 +1,79 @@
# Makefile to create all versions of the Twitter Color Emoji SVGinOT font
# Run with: make -j [NUMBER_OF_CPUS]

TMP := /tmp
# Use Linux Shared Memory to avoid wasted disk writes.
#TMP := /dev/shm

# Where to find scfbuild?
SCFBUILD := SCFBuild/bin/scfbuild

VERSION := 1.0-alpha
FONT_PREFIX := build/TwitterColorEmoji-SVGinOT
REGULAR_FONT := $(FONT_PREFIX).ttf
REGULAR_ZIP := $(FONT_PREFIX)-$(VERSION).zip

# There are two SVG source directories to keep the assets separate.
SVG_TWEMOJI := assets/twemoji-svg
# Currently empty
SVG_MORE := assets/svg

# Create the lists of traced and color SVGs
SVG_FILES := $(wildcard $(SVG_TWEMOJI)/*.svg) $(wildcard $(SVG_MORE)/*.svg)
SVG_STAGE_FILES := $(patsubst $(SVG_TWEMOJI)/%.svg, build/stage/%.svg, $(SVG_FILES))
SVG_STAGE_FILES := $(patsubst $(SVG_MORE)/%.svg, build/stage/%.svg, $(SVG_STAGE_FILES))
SVG_TRACE_FILES := $(patsubst build/stage/%.svg, build/svg-trace/%.svg, $(SVG_STAGE_FILES))
SVG_COLOR_FILES := $(patsubst build/stage/%.svg, build/svg-color/%.svg, $(SVG_STAGE_FILES))

.PHONY: all package clean

all: $(REGULAR_FONT)

package: all
rm -f $(REGULAR_ZIP)
7z a -tzip -mx=9 $(REGULAR_ZIP) ./$(REGULAR_FONT)

$(REGULAR_FONT): $(SVG_TRACE_FILES) $(SVG_COLOR_FILES)
$(SCFBUILD) -c scfbuild.yml -o $(REGULAR_FONT) --font-version="$(VERSION)"

# Create black SVG traces of the color SVGs to use as glyphs.
# 1. Make the EmojiOne SVG into a PNG with Inkscape
# 2. Make the PNG into a BMP with ImageMagick and add margin by increasing the
# canvas size to allow the outer "stroke" to fit.
# 3. Make the BMP into a Edge Detected PGM with mkbitmap
# 4. Make the PGM into a black SVG trace with potrace
build/svg-trace/%.svg: build/staging/%.svg | build/svg-trace
inkscape -w 1000 -h 1000 -z -e $(TMP)/$(*F).png $<
convert $(TMP)/$(*F).png -gravity center -extent 1066x1066 $(TMP)/$(*F).bmp
rm $(TMP)/$(*F).png
mkbitmap -g -s 1 -f 10 -o $(TMP)/$(*F).pgm $(TMP)/$(*F).bmp
rm $(TMP)/$(*F).bmp
potrace --flat -s --height 2048pt --width 2048pt -o $@ $(TMP)/$(*F).pgm
rm $(TMP)/$(*F).pgm

# Optimize/clean the color SVG files
build/svg-color/%.svg: build/staging/%.svg | build/svg-color
svgo -i $< -o $@

# Copy the files from multiple directories into one source directory
build/staging/%.svg: $(SVG_TWEMOJI)/%.svg | build/staging
cp $< $@

build/staging/%.svg: $(SVG_MORE)/%.svg | build/staging
cp $< $@

# Create the build directories
build:
mkdir build

build/staging: | build
mkdir build/staging

build/svg-trace: | build
mkdir build/svg-trace

build/svg-color: | build
mkdir build/svg-color

clean:
rm -rf build
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -7,11 +7,13 @@ emoji in Mozilla Firefox and Thunderbird. This is not a limitation of the font,
but of the operating systems and applications. Regular B&W outline emoji are
included for backwards/fallback compatibility.

[Do you like Emoji One graphics better?][2] **You can use this now**
[Do you like Emoji One graphics better?][2]

[1]: https://github.com/twitter/twemoji
[2]: https://github.com/eosrei/emojione-color-font

Get the **alpha** version from releases: https://github.com/eosrei/twemoji-color-font/releases

# More details coming soon!

## Install on Linux
Expand Down
35 changes: 35 additions & 0 deletions scfbuild.yml
@@ -0,0 +1,35 @@
# SCFBuild configuration file for Twitter Color Emoji
output_file: build/TwitterEmojiColor-SVGinOT.ttf
verbose: False
glyph_svg_dir: build/svg-trace
color_svg_dir: build/svg-color
# Translate the SVGs on import into glyphs.
# y+150 for correct emoji-only vertical alignment.
glyph_translate_x: 0
glyph_translate_y: 150
# The SVGs are 45x45. They are scaled to 1000x1000 by the Firefox renderer, but
# need adjustment to line up correctly. 8/10*2048 = 1638 = Default font ascent.
# y+150 for correct emoji-only vertical alignment.
color_transform: translate(0 -1788) scale(2.048)
table_name:
copyright: >
Copyright 2016 Brad Erickson CC-BY.
Copyright 2016 Twitter, Inc. CC-BY.
family: Twitter Color Emoji
# Subfamily is also called Style or Weight. Often set to: Regular
subfamily: Regular
unique_id: Twitter Color Emoji SVGinOT eosrei.net
full_name: Twitter Color Emoji SVGinOT
#version:
# No spaces in PostScript Names
postscript_name: TwitterColorEmojiSVGinOT
#trademark:
manufacturer: Brad Erickson
designer: Twitter, Inc.
description: >
A SVGinOT color emoji font using the Twitter Emoji for Everyone set:
https://github.com/eosrei/twemoji-color-font/
url_vendor: https://github.com/eosrei/twemoji-color-font/
url_designer: https://github.com/twitter/twemoji
license: Creative Commons Attribution 4.0 International
url_license: http://creativecommons.org/licenses/by/4.0/

0 comments on commit 04d4551

Please sign in to comment.