Skip to content

Commit

Permalink
Merge pull request #1306 from rpspringuel/fonts
Browse files Browse the repository at this point in the history
Dealing with the supplemental fonts
  • Loading branch information
rpspringuel authored Feb 24, 2017
2 parents 5bdee15 + d5e9396 commit af79698
Show file tree
Hide file tree
Showing 10 changed files with 303 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).
- `initial-style` gabc header, supplanted by the `\gresetinitiallines` TeX command.
- `biginitial` style, consolidated into the `initial` style.
- `\grescorereference`
- The gregorio and granapadano fonts are no longer distributed with the Gregorio distribution archive. They will now be available for download separately (along with optional Dominican "-op" variants). ***If there are other logistics, put them here or delete this statement before release.*** See [UPGRADE.md](UPGRADE.md) and [#844](https://github.com/gregorio-project/gregorio/issues/844) for details.
- The Gregorio and Grana Padano fonts are no longer distributed with the Gregorio distribution archive. They will now be available for download separately (along with their Dominican "-op" variants) in `supp_fonts-5_0_0.zip` (the version number will change to match future releases). See [UPGRADE.md](UPGRADE.md) and [#844](https://github.com/gregorio-project/gregorio/issues/844) for details.


## [4.2.1][Unreleased]
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ You can also try it online [here](http://dev.illuminarepublications.com/gregorio

You need a recent and working [TeXLive](https://www.tug.org/texlive/), on top of which you just need to install latest [Gregorio release](https://github.com/gregorio-project/gregorio/releases). See [the website](http://gregorio-project.github.io/installation.html) for more details.

**Note:** Due to a bug in the current release (v2.7-fix-3) of `luaotfload` the documentation cannot be built against TeXLive 2016 (see [#1188](https://github.com/gregorio-project/gregorio/issues/1188)). As a result, building from a clone of the repository will fail against that version. A work around for this bug exists ([9fe9139](https://github.com/henryso/gregorio/commit/9fe9139178dce6adebffbae65016800748450b61), but using it breaks compilation under TeXLive 2015 and the bug has been fixed in the latest master for `luaotfload`. The result is that users should do one of the following:
**Note:** Due to a bug in the v2.7-fix-3 release of `luaotfload` the documentation cannot be built against TeXLive 2016 if you have that version of `luaotfload` (see [#1188](https://github.com/gregorio-project/gregorio/issues/1188)). The result is that users should do one of the following:

- Install from the distribution tar ball (recommended for those installing a stable release).
- Switch to TeXLive 2015 to build the docs.
- Upgrade your `luaotfload` to a more recent version (v2.8-rc1 or later).
- Install from the distribution tar ball where the documentation is already built (recommended for those installing a stable release).
- Switch to TeXLive 2015 (which uses an earlier version of `luaotfload`) to build the docs.
- Upgrade your `luaotfload` to a more recent version (v2.8 or later).

## Documentation

Expand Down
16 changes: 13 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ This file contains instructions to upgrade to a new release of Gregorio.

The `autocompile` option is now the default option for the behavior of `\gregorioscore`. If you want to go back to the old, manual behavior, then you should pass the `nevercompile` option when loading `gregoriotex`.

### Gregorio and Grana Padano fonts
### Additional fonts

The gregorio and granapadano fonts, as well as their "-op" Dominican variants, will now be available as separate downloads. If you were using these fonts, either download and install them or switch to greciliae, which continues to be distributed along with Gregorio by default.
With the addition of more cavum shapes, the number of font options which come with Gregorio (the package) by default has been reduced in order to control the download size. From now on only Greciliae will be installed by default. The Gregorio and Grana Padano fonts, as well as their "-op" Dominican variants, will now be available as a separate download. If you were using these fonts, either download `supp_fonts-5_0_0.zip` and install them or switch to Greciliae.

To install the new versions of Gregorio (the font) and Grana Padano, unzip `supp_fonts-5_0_0.zip`, navigate to the uncompressed folder in Terminal (or Command Prompt on Windows) and execute `texlua install_supp_fonts.lua` after you have installed the main Gregorio distribution. This script will look for the location of Greciliae and copy the other fonts to that location. If you wish to control the installation of the fonts manually, the script takes an optional argument with one of the following values:

* `auto` (optional): the same folder as Greciliae
* `system`: the appropriate font folder in `$TEXMFLOCAL`
* `user`: the appropriate font folder in `$TEXMFHOME`
* `<dir>`: the name of an alternate texmf root directory you want to use

Additionally, if you are building the fonts yourself from a git clone, `install-gtex.sh` and `install_supp_fonts.lua` will install all the fonts you have built, not just the ones they are normally distributed with.

**Note:** All the above methods assume you only need to access the fonts from within a TeX document (and thus are designed to put them into the correct folder in a texmf tree). If you want to use the fonts in other programs, then you will need to consult the documentation appropriate to your platform and/or the program and manually move, copy, or link the fonts to the necessary location.

*** NOTE: put the logistics of these downloads here once they've been determined ***

### Ledger lines

Expand Down
12 changes: 12 additions & 0 deletions contrib/system-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,24 @@ for %%G in (%files%) do (

:: Font Files
set files=greciliae.ttf ^
greciliae-hollow.ttf ^
greciliae-hole.ttf ^
greciliae-op.ttf ^
greciliae-op-hollow.ttf ^
greciliae-op-hole.ttf ^
greextra.ttf ^
gregorio.ttf ^
gregorio-hollow.ttf ^
gregorio-hole.ttf ^
gregorio-op.ttf ^
gregorio-op-hollow.ttf ^
gregorio-op-hole.ttf ^
granapadano.ttf ^
granapadano-hollow.ttf ^
granapadano-hole.ttf ^
granapadano-op.ttf ^
granapadano-op-hollow.ttf ^
granapadano-op-hole.ttf ^
gregall.ttf

for %%G in (%files%) do (
Expand Down
12 changes: 12 additions & 0 deletions contrib/system-setup.command
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,24 @@ done
# Font Files
files="greciliae.ttf
greciliae-hollow.ttf
greciliae-hole.ttf
greciliae-op.ttf
greciliae-op-hollow.ttf
greciliae-op-hole.ttf
greextra.ttf
gregorio.ttf
gregorio-hollow.ttf
gregorio-hole.ttf
gregorio-op.ttf
gregorio-op-hollow.ttf
gregorio-op-hole.ttf
granapadano.ttf
granapadano-hollow.ttf
granapadano-hole.ttf
granapadano-op.ttf
granapadano-op-hollow.ttf
granapadano-op-hole.ttf
gregall.ttf"
for f in $files
Expand Down
30 changes: 22 additions & 8 deletions fonts/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,23 @@ TTF_GRECILIAE_OP = greciliae-op.ttf greciliae-op-hollow.ttf greciliae-op-hole.tt
TTF_GREGORIO = gregorio.ttf gregorio-hollow.ttf gregorio-hole.ttf
TTF_GREGORIO_OP = gregorio-op.ttf gregorio-op-hollow.ttf gregorio-op-hole.ttf
TTF_GRANAPADANO = granapadano.ttf granapadano-hollow.ttf granapadano-hole.ttf
TTF_GRANAPADANO_OP = granapadano-op.ttf granapadano-op-hollow.ttf granapadano-op-hole.ttf
TTF_GRANAPADANO_OP = granapadano-op.ttf granapadano-op-hollow.ttf \
granapadano-op-hole.ttf
TTF_EXTRA = greextra.ttf gregall.ttf gresgmodern.ttf grelaon.ttf
TTF_ALL = $(TTF_GRECILIAE) $(TTF_GRECILIAE_OP) $(TTF_GREGORIO) \
$(TTF_GREGORIO_OP) $(TTF_GRANAPADANO) $(TTF_GRANAPADANO_OP)
SOURCEFILES = gregorio-base.sfd granapadano-base.sfd greciliae-base.sfd \
greextra.sfd gregall.sfd gresgmodern.sfd grelaon.sfd

EXTRA_DIST = $(TTF_GRECILIAE) $(TTF_GRECILIAE_OP) $(TTF_EXTRA) $(SOURCEFILES) \
squarize.py stemsschemas.py convertsfdtottf.py README.md simplify.py
TTF_ALL = $(TTF_GRECILIAE) $(TTF_GRECILIAE_OP) \
$(TTF_GREGORIO) $(TTF_GREGORIO_OP) \
$(TTF_GRANAPADANO) $(TTF_GRANAPADANO_OP)
SOURCEFILES_GRECILIAE = greciliae-base.sfd
SOURCEFILES_GREGORIO = gregorio-base.sfd
SOURCEFILES_GRANAPADANO = granapadano-base.sfd
SOURCEFILES_EXTRA = greextra.sfd gregall.sfd gresgmodern.sfd grelaon.sfd
SOURCEFILES_TOOLS = squarize.py stemsschemas.py convertsfdtottf.py README.md \
simplify.py
SOURCEFILES_ALL = $(SOURCEFILES_GREGORIO) $(SOURCEFILES_GRANAPADANO) \
$(SOURCEFILES_GRECILIAE)

EXTRA_DIST = $(TTF_GRECILIAE) $(TTF_GRECILIAE_OP) $(TTF_EXTRA) \
$(SOURCEFILES_GRECILIAE) $(SOURCEFILES_EXTRA) $(SOURCEFILES_TOOLS)

FONTFORGE = fontforge
RM = rm
Expand Down Expand Up @@ -107,3 +115,9 @@ really-all-fonts: greciliae-all gregorio-all granapadano-all extra
fonts: greciliae-all extra

all: $(GREGORIO_FONTS)

supp-fonts-dist: gregorio-all granapadano-all
zip supp_fonts-$(FILENAME_VERSION).zip $(TTF_GREGORIO) $(TTF_GREGORIO_OP) \
$(TTF_GRANAPADANO) $(TTF_GRANDAPADANO_OP) \
$(SOURCEFILES_GREGORIO) $(SOURCEFILES_GRANAPADANO) \
install_supp_fonts.lua README_supp.md
46 changes: 37 additions & 9 deletions fonts/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,47 @@
# Font generation
# Gregorian Chant Fonts

Gregorio uses .ttf fonts to for the chant. They are built in the distributed tarballs, but if you really need to compile them:
Gregorio uses .ttf fonts to represent the various glyphs in Gregorian chant. While there are hundreds of unique glyphs when you look at the entire body of Gregorian chant, these glyphs are usually composites of a relitively small number of components. Rather than manage the huge number of glyphs, therefore, this project maintains the smaller component set for its fonts and then assembles these components into the various glyphs as part of the build process. This minimizes the work load for the developers while still enabling customization at the glyph (rather than the component) level within documents created with Gregorio.

Currently there are three fonts maintained as part of this project:

* Greciliae, an adaptation of [Caeciliae](http://marello.org/caeciliae/) for use with Gregoiro
* Gregorio, the original font produced as part of this project
* Grana Padano, an adaptation of Parmesan from [Lilypond](http://www.lilypond.org/index.html)

Each of these fonts comes with separate file for solid, hollow, and hole glyphs (holes are the "filling" in a hollow glyph which prevent an object behind the hollow glyph from showing through).

Each file also has an "-op" variant in which certain glyph shapes are tweaked to be more like the shapes found in specifically Dominican chant collections.

## Font Packaging

Greciliae (in all its varieties) is packaged as the default font and is installed when the package itself is installed using any of the available methods.

Gregorio and Grana Padano (in all their varieties) are distributed separately in `supp_fonts-$GREGORIOVERSION.zip` (fonts are version specific and will only work with the matching version of Gregorio).

## Font generation

The fonts are distributed pre-built, but if you really need to compile them:

* install [fontforge](http://fontforge.github.io) with python extension
* run `make fonts` in this directory (using the `-j` argument can save you some time here)
* run `make fonts` (Greciliae only) or `make really-all-fonts` (all three fonts) in this directory (using the `-j` argument can save you some time here)
* then you can test them directly, or install them (see next section)

# Font installation
## Font installation

Greciliae is installed automatically by all the normal installation methods (see [Installation](http://gregorio-project.github.io/installation.html) and follow the link to the instructions specific to your platform).

`supp_fonts-$GREGORIOVERSION.zip` comes with a Lua script (`install_supp_fonts.lua`) which can be used to install Gregorio and Grana Padano. To use this script, unzip the archive, open Terminal (or Command Prompt, if you are on Windows), change to the directory of the decompressed archive, and then run `texlua install_supp_fonts.lua`. This command can take an argument indicating where you want the fonts to go:

Fonts are installed with the usual process:
* `install-gtex.sh` if you're under OSX or GNU/Linux
* copy in `C:\Windows\Fonts` under Windows
* `auto` (optional): the same folder as Greciliae
* `system`: the appropriate font folder in `$TEXMFLOCAL`
* `user`: the appropriate font folder in `$TEXMFHOME`
* `<dir>`: the name of an alternate texmf root directory you want to use

Additionally, if you are building from a git clone, `install-gtex.sh` and `install_supp_fonts.lua` will install all the fonts you have built, not just the ones they are normally distributed with.

The most important is that they must be found by [fontconfig](http://www.freedesktop.org/wiki/Software/fontconfig/).
**Note:** All the above methods assume you only need to access the fonts from within a TeX document. If you want to use the fonts in other programs, then you will need to consult the documentation appropriate to your platform and manually move, copy, or link the fonts to the necessary location.

# Stem length
## Stem length

Stem length are entirely configurable in gregorio, but are set during the time of font creation, so you cannot change it without modifying the font.

Expand Down
22 changes: 22 additions & 0 deletions fonts/README_supp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Supplamental Fonts

In addition to the default font, Greciliae, there are two fully featured supplamental fonts:

* Gregorio, the original font produced as part of this project
* Grana Padano, an adaptation of Parmesan from [Lilypond](http://www.lilypond.org/index.html)

Like Greciliae, each of these fonts comes with separate file for solid, hollow, and hole glyphs (holes are the "filling" in a hollow glyph which prevent an object behind the hollow glyph from showing through).

Also like Greciliae, each file also has an "-op" variant in which certain glyph shapes are tweaked to be more like the shapes found in specifically Dominican chant collections.

## Font installation

The Lua script `install_supp_fonts.lua` can be used to install Gregorio and Grana Padano. To use this script, open Terminal (or Command Prompt, if you are on Windows), change to this directory, and then run `texlua install_supp_fonts.lua`. This command can take an argument indicating where you want the fonts to go:

* `auto` (optional): the same folder as Greciliae
* `system`: the appropriate font folder in `$TEXMFLOCAL`
* `user`: the appropriate font folder in `$TEXMFHOME`
* `<dir>`: the name of an alternate texmf root directory you want to use

**Note:** The script assumes you only need to access the fonts from within a TeX document. If you want to use the fonts in other programs, then you will need to consult the documentation appropriate to your platform and manually move, copy, or link the fonts to the necessary location.

169 changes: 169 additions & 0 deletions fonts/install_supp_fonts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#!/usr/bin/env texlua
--[[
Gregorio font automatic installation script.
Copyright (C) 2010-2017 Gregorio Project authors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This texlua script is called in order to install the extra fonts which are not
included in the default installation of Gregorio.
--]]

require("lfs")

kpse.set_program_name('luatex')

local pathsep = '/'

local function fixpath(path)
return path
end

local function remove_trailing_slash(path)
return path:gsub("/$" ,"")
end

local function basename(path)
return path:gsub("^[^/]+/" ,"")
end

if os.type == "windows" or os.type == "msdos" then
pathsep = '\\'
fixpath = function(path)
return path:gsub("/", "\\")
end
remove_trailing_slash = function(path)
return path:gsub("\\$" ,"")
end
basename = function(path)
return path:gsub("^[^\\]+\\" ,"")
end
end

local source_files = {}
for file in lfs.dir(lfs.currentdir()) do
if file:match('-base.sfd$') then
table.insert(source_files,1,file)
end
end
local font_files = {}
for _, file in pairs(source_files) do
local temp = file:match('.*-'):sub(1,-2)
for file in lfs.dir(lfs.currentdir()) do
if file:match('^'..temp..'.*%.ttf$') then
table.insert(font_files,1,file)
end
end
end

function io.loaddata(filename,textmode)
local f = io.open(filename,(textmode and 'r') or 'rb')
if f then
local data = f:read('*all')
f:close()
return data
else
return nil
end
end

function io.savedata(filename,data,joiner)
local f = io.open(filename,"wb")
if f then
f:write(data or "")
f:close()
return true
else
return false
end
end

function copy_one_file(src, dest)
local destfile = dest..basename(src)
print(src.." -> "..destfile)
io.savedata(destfile, io.loaddata(src))
end

local install_dir = arg[1] or "auto"
if install_dir == "auto" then
font_target = "greciliae.ttf"
font_directory = kpse.find_file(font_target,"truetype fonts")
if font_directory then
font_directory = font_directory:sub(1,-string.len(font_target)-1)
else
print("I can't find greciliae.ttf. Are you sure Gregorio is installed?")
do return end
end
source_target = "greciliae-base.sfd"
source_directory = kpse.find_file(source_target,"mf")
if source_directory then
source_directory = source_directory:sub(1,-string.len(source_target)-1)
else
print("I can't find greciliae-base.sfd. Are you sure Gregorio is installed?")
do return end
end
elseif install_dir == "user" then
install_dir = kpse.expand_var("$TEXMFHOME")
font_directory = fixpath(install_dir.."/fonts/truetype/public/gregoriotex/")
source_directory = fixpath(install_dir.."/fonts/source/gregoriotex/")
elseif install_dir == "system" then
install_dir = kpse.expand_var("$TEXMFLOCAL")
font_directory = fixpath(install_dir.."/fonts/truetype/public/gregoriotex/")
source_directory = fixpath(install_dir.."/fonts/source/gregoriotex/")
else
font_directory = fixpath(install_dir.."/fonts/truetype/public/gregoriotex/")
source_directory = fixpath(install_dir.."/fonts/source/gregoriotex/")
end

if not lfs.isdir(install_dir) then
start,stop = string.find(install_dir,pathsep)
while start do
if not lfs.isdir(install_dir:sub(1,start)) then
lfs.mkdir(install_dir:sub(1,start))
end
start,stop = string.find(install_dir,pathsep,stop+1)
end
lfs.mkdir(install_dir)
end

if not lfs.isdir(font_directory) then
print("making "..font_directory)
if not lfs.isdir(fixpath(install_dir.."/fonts/truetype/public/")) then
if not lfs.isdir(fixpath(install_dir.."/fonts/truetype/")) then
if not lfs.isdir(fixpath(install_dir.."/fonts/")) then
lfs.mkdir(fixpath(install_dir.."/fonts/"))
end
lfs.mkdir(fixpath(install_dir.."/fonts/truetype/"))
end
lfs.mkdir(fixpath(install_dir.."/fonts/truetype/public/"))
end
lfs.mkdir(font_directory)
end
if not lfs.isdir(source_directory) then
print("making "..source_directory)
if not lfs.isdir(fixpath(install_dir.."/fonts/source/")) then
lfs.mkdir(fixpath(install_dir.."/fonts/source/"))
end
lfs.mkdir(source_directory)
end

-- truetype font files
for _, file in pairs(font_files) do
copy_one_file(file,font_directory)
end

-- source files
for _, file in pairs(source_files) do
copy_one_file(file,source_directory)
end
Loading

0 comments on commit af79698

Please sign in to comment.