Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed May 1, 2012
0 parents commit 4ba31d9
Show file tree
Hide file tree
Showing 24 changed files with 1,351 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "support/font-builder"]
path = support/font-builder
url = git://github.com/fontello/font-builder.git
64 changes: 64 additions & 0 deletions DEVELOPMENT.md
@@ -0,0 +1,64 @@
Development docs
================

Set if scripts to easily build webfonts from SVG images

Installation
------------

### Ubuntu

**(!)** Use Ubuntu **12.04**. Or you will have to manually install fresh
freetype library, to build ttfautohint.

Init font-builder and build additional software (ttf2eot, ttfautohint):

make support

Install system dependencies (fontforge & python modules):

cd support/font-builder && sudo make dev-deps


If you are working on multiple font you would like to have only one instance of
heavy dependencies like _ttfautohint_ installed. Run this:

cd support/font-builder && sudo make support-install


Note that you don't need to install system dependencies more than once.


### Mac

TBD. Anyone, please help.


### Windows

TBD. Anyone, please help.


Making font
-----------

### Steps

1. Place images into `/src/svg` folder.
2. Add image info to `config.yml` (see comments in it)
3. Edit css/html templates, if needed.
4. Run `make`

Generated data will be placed in `./font`

You can rebuild css/html only with `make html`

### SVG image requirements

Any image will be proportionnaly scaled, to fit height in ascent-descent
It's convenient to make height = 1000px. Default font baseline will be 20% from
the bottom.

In most cases it's ok to visually allign icons to middle line, not to baseline.
If you are not shure, how to start - make image with 10% top/bottom padding.
Then generate demo page and tune scale/offset.
91 changes: 91 additions & 0 deletions Makefile
@@ -0,0 +1,91 @@
PROJECT := $(notdir ${PWD})
FONT_NAME := brandico


################################################################################
## ! DO NOT EDIT BELOW THIS LINE, UNLESS YOU REALLY KNOW WHAT ARE YOU DOING ! ##
################################################################################


TMP_PATH := /tmp/${PROJECT}-$(shell date +%s)
REMOTE_NAME ?= origin
REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)


# Add local versions of ttf2eot nd ttfautohint to the PATH
PATH := $(PATH):./support/font-builder/support/ttf2eot
PATH := $(PATH):./support/font-builder/support/ttfautohint/frontend
PATH := $(PATH):./support/font-builder/bin


dist: font html


font:
@if test ! -d support/font-builder/bin ; then \
echo "font-builder binaries not found. run:" >&2 ; \
echo " make support" >&2 ; \
exit 128 ; \
fi
@if test ! `which ttf2eot` ; then \
echo "ttf2eot not found. run:" >&2 ; \
echo " make support" >&2 ; \
exit 128 ; \
fi
@if test ! `which ttfautohint` ; then \
echo "ttfautohint not found. run:" >&2 ; \
echo " make support" >&2 ; \
exit 128 ; \
fi
fontbuild.py -c ./config.yml -t ./src/font_template.sfd -i ./src/svg -o ./font/$(FONT_NAME).ttf
font_transform.py -c ./config.yml -i ./font/$(FONT_NAME).ttf -o ./font/$(FONT_NAME)-transformed.ttf
mv ./font/$(FONT_NAME)-transformed.ttf ./font/$(FONT_NAME).ttf
ttfautohint --latin-fallback --hinting-limit=200 --hinting-range-max=50 --symbol ./font/$(FONT_NAME).ttf ./font/$(FONT_NAME)-hinted.ttf
mv ./font/$(FONT_NAME)-hinted.ttf ./font/$(FONT_NAME).ttf
fontconvert.py -i ./font/$(FONT_NAME).ttf -o ./font
ttf2eot < ./font/$(FONT_NAME).ttf >./font/$(FONT_NAME).eot


npm-deps:
@if test ! `which npm` ; then \
echo "Node.JS and NPM are required for html demo generation." >&2 ; \
echo "This is non-fatal error and you'll still be able to build font," >&2 ; \
echo "however, to build demo with >> make html << you need:" >&2 ; \
echo " - Install Node.JS and NPM" >&2 ; \
echo " - Run this task once again" >&2 ; \
else \
npm install -g jade js-yaml.bin ; \
fi


support:
git submodule init support/font-builder
git submodule update support/font-builder
which ttf2eot ttfautohint > /dev/null || (cd support/font-builder && $(MAKE))
which js-yaml jade > /dev/null || $(MAKE) npm-deps


html:
CONFIG=$$(js-yaml --to-json ./config.yml) && \
jade --pretty --obj "$$CONFIG" --out ./font ./src/demo.jade
fontdemo.py -c ./config.yml ./src/css.mustache ./font/$(FONT_NAME).css


gh-pages:
@if test -z ${REMOTE_REPO} ; then \
echo 'Remote repo URL not found' >&2 ; \
exit 128 ; \
fi
cp -r ./font ${TMP_PATH} && \
touch ${TMP_PATH}/.nojekyll
cd ${TMP_PATH} && \
git init && \
git add . && \
git commit -q -m 'refreshed gh-pages'
cd ${TMP_PATH} && \
git remote add remote ${REMOTE_REPO} && \
git push --force remote +master:gh-pages
rm -rf ${TMP_PATH}


.PHONY: font npm-deps support
20 changes: 20 additions & 0 deletions README.md
@@ -0,0 +1,20 @@
"Crowd-sourced" collection of popular logos, mostly for use in fontello. Since
it's not good to duplicate logos in every custom font, we did a separate-one.

License
-------

### Icons, font

Font is distributed under
[SIL](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) licence.

All icons are distributed under
[CC BY](http://creativecommons.org/licenses/by-sa/3.0/) licence.


### Scripting

This project uses [font-builder](https://github.com/fontello/font-builder)
scripts to generate data.

154 changes: 154 additions & 0 deletions config.yml
@@ -0,0 +1,154 @@
---
# This is configuration file for font builder and other support scripts.
# Format is descriped below.
#
#
# # metadata, to generate demo & fontello info dialogs
# meta:
#
# author: Daniel Buce
# homepage: http://...
# email: ...
# twitter: http://twitter.com/...
# dribble: http://dribbble.com/...
# licence: SIL
# licence_url: http://scripts.sil.org/OFL
#
# css-prefix: "icon-" # prefix for css-generated classes
# demo-columns: 4 # used for html demo page generation
#
# # Font headers. All vars from here will be used as font
# # params in fontforge http://fontforge.sourceforge.net/python.html
# font:
#
# version: "1.0"
#
# # use !!!small!!! letters a-z, or Opera will fail under OS X
# # fontname will be also used as file name.
# fontname: myfont
#
# fullname: MyFont
# familyname: Myfont
#
# copyright: Copyright (C) 2012 by xxxxxxxx
#
# ascent: 1638
# descent: 410
# weight: Regular
#
#
# #
# # Optional. You can apply global rescale + offset to all font glyphs.
# # Param values ar 0..1, where 1 = 100%.
# #
# transform:
# baseline: 0.2 # baseline for rescale symmetry. Default value
# # calculated from ascent/decsent
# rescale: 0.68 # rescale glyphs and center around baseline
# offset: -0.1 # shift up/down
#
# glyphs:
# - file: glyph1_file # file name, without extention
# from: 0xNNN # Source code for remapper or merge tool
# code: 0xNNN # Symbol code 0x - hex
# css: icon-gpyph1-name # For generated CSS
# search: [word1, word2] # Search aliases (array). CSS name will be
# # included automatically
# src: first_font_alias # alias to font for merge tool
# # list of aliases in src_fonts section
#
# #
# # local transformations, only for this glyph (optional)
# #
# transform: # personal glyph transformation.
# rescale_rel # *_rel - applyed after global.
# offset: 0.2 # without *_rel - override global
#
# #
# # Fonts aliases used only in font merge tool
# #
# src_fonts:
# first_font_alias: "/absolute/path/to/first/font.ttf"
#
################################################################################
#


meta:
author: Croud Sourced, for Fontello project
github: https://github.com/fontello/brandico.font
licence: SIL
licence_url: http://scripts.sil.org/OFL

css_prefix: "icon-"
columns: 4

transform:
baseline: 0.5

font:
version: "1.0"

# use !!!small!!! letters a-z, or Opera will fail under OS X
# fontname will be also used as file name.
fontname: brandico

fullname: Brandico
familyname: Brandico

copyright: (C) 2012 by Vitaly Puzrin

ascent: 800
descent: 200


glyphs:

- file: facebook
code: 0xf300
css: facebook
transform:
offset: 0.05
meta:
author: Alex Peattie
homepage: http://www.alexpeattie.com/projects/justvector_icons/
search: [facebook]

- file: facebook-rect
code: 0xf301
css: facebook-rect
transform:
offset: 0.05
meta:
author: Alex Peattie
homepage: http://www.alexpeattie.com/projects/justvector_icons/
search: [facebook]

- file: twitter
code: 0xf302
css: twitter
transform:
offset: 0.05
meta:
author: Vitaly Puzrin
search: [twitter]

- file: twitter-bird
code: 0xf303
css: twitter-bird
transform:
rescale: 0.9
offset: 0.05
meta:
author: Vitaly Puzrin
search: [twitter]

- file: icq
code: 0xf304
css: icq
transform:
offset: 0.05
meta:
author: Vitaly Puzrin
search: [icq]

36 changes: 36 additions & 0 deletions font/brandico.css
@@ -0,0 +1,36 @@
@charset "UTF-8";

@font-face {
font-family: 'brandico';
src: url('brandico.eot');
src: url('brandico.eot?#iefix') format('embedded-opentype'),
url('brandico.woff') format('woff'),
url('brandico.ttf') format('truetype'),
url('brandico.svg#brandico') format('svg');
font-weight: normal; font-style: normal;
}

[class^="icon-"], [class*=" icon-"] {
font-family: brandico;
font-style: normal;

/* font-size: 14px; */

display: inline-block;
width: 1.1em;
margin-right: .1em;
text-align: center;
}

.the-icons li {
font-size: 14px;
line-height: 24px;
height: 24px;
}

.icon-facebook:before { content: ""; } /* '\f300' */
.icon-facebook-rect:before { content: ""; } /* '\f301' */
.icon-twitter:before { content: ""; } /* '\f302' */
.icon-twitter-bird:before { content: ""; } /* '\f303' */
.icon-icq:before { content: ""; } /* '\f304' */

Binary file added font/brandico.eot
Binary file not shown.

0 comments on commit 4ba31d9

Please sign in to comment.