Skip to content

Commit

Permalink
Add feature file auto-generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakmeer committed Dec 21, 2016
1 parent 5bffd91 commit 2ce1709
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
todo.md
39 changes: 39 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

# Zbalermorna Font Development Kit

A collection of tools and processes for using and developing typefaces for
Zbalermorna, an alternative orthography for the constructed language Lojban.


### How a ZLM font works

Zbalermorna uses special glpyhs which live in the Unicode Supplementary
Special Purpose plane, covering the region from 0xE2320 -> 0xE24FF.

A method of inputting these glyphs requires in IME for your particular
operating system, such as `ibus` or `scim`. This project attempts to provide
configurations for as many IMEs as possible.

Once a IME and an appropriate configuration is loaded, it can be used to type
ZLM glyphs, which a correctly constructed ZLM font will automatically display
as assembled composite glpyhs using OpenType features.


### Currently Supported IMEs

- `ibus`


### Creating a new Zbalermorna typeface

- Install [FontForge](http://fontforge.github.io)
- Launch the Preview page: `gulp preview`
- Clone and rename `src/zlm-manri.sfd` to create your own copy
- Open your new copy using FontForge
- Modify vector shapes for component glyphs; composite glyphs will auto-update
- Self-assembling composites can also be manually overriden with real vectors,
if your typeface wants to use special forms for certain composites.
- When your `.sfd` file is saved, Gulp will automatically recompile it into a
TrueType font, and refresh the preview page so you can see how your updates
effect ligaturing and kerning.

98 changes: 98 additions & 0 deletions tools/zlm.feature.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@

#
# Setup
#

# Render glyph names

cons-name = (cons) ->
if cons is \Q or cons is \W
\ZLM_SEMIVOWEL_ + cons
else
\ZLM_ + cons

vowel-name = (vowel) ->
\ZLM_DIACRITIC_ + vowel

liga-cvv = (cons, vowel) ->
if vowel is ''
\ZLM_ + cons
else if cons is \DOT
\ZLM_DOT_ + vowel
else
\ZLM_ + cons + vowel

liga-cvvhvv = (a, b) ->
\ZLM_CAS_ + a + \H + b


# Opentype feature syntax

sub = (...comp, liga) ->
"sub " + (comp.join ' ') + " by #liga;"

feature = (name, xx) ->
write 0 "feature #name {"
xx!
write 0 "} #name;"
blank!


# Output helpers

log = console.log.bind console

indent = (n, text) -->
(" " * n) + text

comment = (n, text) -->
log indent n, "# #text"

write = log . indent

blank = -> log ""


# Data

CONSN = <[ DOT H P T K F L S C M X B D G V R Z J N Q W ]>
VOWEL = <[ A E I O U Y AI EI OI AU ]>


#
# Generation
#

# Generate class defs
blank!
comment 0, "Class Defs"
write 0 "@vowel = [ " + (VOWEL.map vowel-name) + " ]"
write 0 "@consonant = [ " + (CONSN.map cons-name) + " ]"
write 0 "@anything = [ @vowel @consonant ]"
blank!

# Generate self-dotting vowels
comment 0, "Self-dotting vowels"
feature \rlig, ->
write 2 "ignore sub @anything @vowel';"
for vowel in VOWEL
write 2 sub (vowel-name vowel), (liga-cvv \DOT, vowel)

# Generate CV series
comment 0, "CV Series"
feature \rlig, ->
for cons in CONSN
blank!
comment 2, "#cons Series"
for vowel in VOWEL
write 2 sub (cons-name cons), (vowel-name vowel), (liga-cvv cons, vowel)

# Generate CVV'VV series
comment 0, "CVV'VV Series"
feature \rlig, ->
for vowel-a in VOWEL
blank!
comment 2, "#vowel-a Series"
for vowel-b in VOWEL
write 2, sub (vowel-name vowel-a), \ZLM_H, (vowel-name vowel-b), (liga-cvvhvv vowel-a, vowel-b)

0 comments on commit 2ce1709

Please sign in to comment.