diff --git a/.gitignore b/.gitignore
index e5dd433..83bf0a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
fontprep/server/public/
-FontPrep.xcodeproj/project.xcworkspace/xcuserdata/
-FontPrep.xcodeproj/xcuserdata/
+FontPrep.xcodeproj/project.xcworkspace/xcuserdata
+FontPrep.xcodeproj/project.xcworkspace/xcshareddata
+FontPrep.xcodeproj/xcuserdata
.sass-cache
.DS_Store
diff --git a/FontPrep.xcodeproj/project.xcworkspace/xcuserdata/brian.xcuserdatad/UserInterfaceState.xcuserstate b/FontPrep.xcodeproj/project.xcworkspace/xcuserdata/brian.xcuserdatad/UserInterfaceState.xcuserstate
deleted file mode 100755
index 06eee0e..0000000
Binary files a/FontPrep.xcodeproj/project.xcworkspace/xcuserdata/brian.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ
diff --git a/fontprep/FontPrep-Info.plist b/fontprep/FontPrep-Info.plist
index 3eabd4d..b6bccac 100755
--- a/fontprep/FontPrep-Info.plist
+++ b/fontprep/FontPrep-Info.plist
@@ -17,11 +17,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 3.1.0
+ 3.1.1
CFBundleSignature
????
CFBundleVersion
- 3.1.0
+ 3.1.1
LSApplicationCategoryType
public.app-category.developer-tools
LSMinimumSystemVersion
diff --git a/fontprep/scripts/run.sh b/fontprep/scripts/run.sh
index fc30b76..7ac9919 100644
--- a/fontprep/scripts/run.sh
+++ b/fontprep/scripts/run.sh
@@ -6,4 +6,4 @@
# Created by Brian M. Gonzalez on 6/11/13.
# Copyright (c) 2013 gnzlz. All rights reserved
-cd ../server && /usr/bin/ruby ./app.rb $1
+cd ../server && ruby ./app.rb $1
diff --git a/fontprep/server/app.rb b/fontprep/server/app.rb
index 445b1c2..9b0bb5a 100644
--- a/fontprep/server/app.rb
+++ b/fontprep/server/app.rb
@@ -5,8 +5,8 @@
# Load in gems
####################################################
-Dir.glob(File.join(File.dirname(__FILE__), "vendor", "gems", "*","lib")).each do |lib|
- $LOAD_PATH.unshift File.expand_path(lib)
+Dir.glob(File.join(File.dirname(__FILE__), "vendor", "gems", "*","lib")).each do |lib|
+ $LOAD_PATH.unshift File.expand_path(lib)
end
####################################################
@@ -23,7 +23,7 @@
require 'sprockets-sass'
require 'sprockets-helpers'
require 'uglifier'
-require 'multi_json'
+require 'json'
Dir.glob('./application/**/*.rb') do |file|
require file
@@ -36,7 +36,6 @@
####################################################
FontPrep.initialize_app!
-FontPrep.themes
####################################################
# Main FontPrep Sinatra Class.
@@ -62,7 +61,7 @@ class FPApp < Sinatra::Base
set :javascripts, './application/assets/javascripts'
set :fonts, './application/assets/fonts'
set :logging, true
- set :static, true
+ set :static, true
set :haml, :format => :html5
set :port, ENV['PORT'] || 7500
@@ -70,7 +69,7 @@ class FPApp < Sinatra::Base
set :app_values, app
before do
- cache_control 'no-cache'
+ cache_control 'no-cache'
end
get '/' do
@@ -103,17 +102,17 @@ class FPApp < Sinatra::Base
# Trap signals to invoke the shutdown procedure cleanly
['INT', 'TERM'].each { |signal|
- trap(signal){
- WEBRICK_HANDLER.shutdown
+ trap(signal){
+ WEBRICK_HANDLER.shutdown
exit!
- }
+ }
}
########################################################
# Use FontPrep Runner to conditionally run FontPrep.
########################################################
-FontPrepRunner.run do
+FontPrepRunner.run do
puts " [FONTPREP] Fontprep is now running on port #{FONTPREP_PORT}."
WEBRICK_HANDLER.run app, :Port => FONTPREP_PORT, :Host => "0.0.0.0"
exit!
diff --git a/fontprep/server/application/lib/fontprep.rb b/fontprep/server/application/lib/fontprep.rb
index 0d2b418..971f447 100644
--- a/fontprep/server/application/lib/fontprep.rb
+++ b/fontprep/server/application/lib/fontprep.rb
@@ -19,36 +19,6 @@ def self.valid_license?(email, license)
true
end
- def self.themes
- themes = []
- Dir.glob('./application/assets/stylesheets/partials/themes/*.scss').each do |theme_file|
- name = File.basename(theme_file, ".scss")
- name.gsub!('_theme_', '')
- themes << name
- end
- themes
- end
-
- def self.set_theme(theme)
- begin
- FileUtils.rm_rf self.default_theme_path
- File.symlink self.theme_path(theme), self.default_theme_path
- FP::Database.set_setting( :theme, theme)
- rescue Exception => e
- FileUtils.rm_rf self.default_theme_path
- File.symlink self.theme_path('ember'), self.default_theme_path
- FP::Database.set_setting( :theme, 'ember')
- end
- end
-
- def self.default_theme_path
- File.join('application', 'assets', 'stylesheets', 'partials', '_variables_theme.scss')
- end
-
- def self.theme_path(name)
- "themes/_theme_#{name}.scss"
- end
-
def self.port
FONTPREP_PORT || 7500
end
diff --git a/fontprep/server/application/lib/initializer.rb b/fontprep/server/application/lib/initializer.rb
index 3e718ef..62a073b 100644
--- a/fontprep/server/application/lib/initializer.rb
+++ b/fontprep/server/application/lib/initializer.rb
@@ -8,7 +8,7 @@
GENERATED_PATH = File.join(APPLICATION_SUPPORT_PATH, 'generated')
DATABASE_PATH = File.join(APPLICATION_SUPPORT_PATH, 'db', 'db.yaml')
DATABASE_DIR = File.join(APPLICATION_SUPPORT_PATH, 'db')
-
+
FUSION_PATH = File.join('external', 'bin', 'fontforge')
TITO_PATH = File.join('external', 'bin', 'ttf2eot')
PYTHON_PATH = File.join('/', 'usr', 'bin', 'python')
@@ -18,7 +18,7 @@
CONVERT_SCRIPT_PATH = File.join('external', 'scripts', 'convert')
CHARS_SCRIPT_PATH = File.join('external', 'scripts', 'chars')
FAMILY_SCRIPT_PATH = File.join('external', 'scripts', 'family')
-WEBFONT_SCRIPT_PATH = File.join('external', 'scripts', 'webfont')
+WEBFONT_SCRIPT_PATH = File.join('external', 'scripts', 'webfont.pe')
NAME_SCRIPT_PATH = File.join('external', 'scripts', 'name')
SVGS_SCRIPT_PATH = File.join('external', 'scripts', 'svgs')
SUBSET_SCRIPT_PATH = File.join('external', 'scripts', 'subset')
diff --git a/fontprep/server/application/lib/installed_font.rb b/fontprep/server/application/lib/installed_font.rb
index 7c6677f..0b0580a 100644
--- a/fontprep/server/application/lib/installed_font.rb
+++ b/fontprep/server/application/lib/installed_font.rb
@@ -56,7 +56,7 @@ def id
id = metadata[:id]
set_data(:id, Sinatra::AppHelpers.random) if not id
- @id = id
+ @id = id
end
def path
@@ -99,7 +99,7 @@ def autohinted_path
end
def name_normalized_path
- File.join(base, "#{name}-name-normlized.ttf")
+ File.join(base, "#{name}-name-normalized.ttf")
end
def woff_path
@@ -149,14 +149,14 @@ def otf?
def web_friendly?
File.exists?(web_friendly_path)
end
-
+
def woff?
File.exists?(woff_path)
end
def eot?
File.exists?(eot_path)
- end
+ end
def svg?
File.exists?(svg_path)
@@ -174,10 +174,10 @@ def average_size
return metadata[:avg_size] if metadata && metadata[:avg_size]
sizes = [0]
sizes << File.size(ttf_path) if ttf?
- sizes << File.size(otf_path) if otf?
+ sizes << File.size(otf_path) if otf?
sizes << File.size(woff_path) if woff?
- sizes << File.size(eot_path) if eot?
- sizes << File.size(svg_path) if svg?
+ sizes << File.size(eot_path) if eot?
+ sizes << File.size(svg_path) if svg?
avg_b = sizes.inject{ |sum, el| sum + el }.to_f / sizes.size
avg_size = avg_b/1024
set_data(:avg_size, avg_size)
@@ -202,10 +202,10 @@ def characters
def process!(except=[])
puts " ** Processing #{name}"
make_metadata unless metadata?
- make_ttf_clean
+ make_ttf_clean
make_ttf unless ttf?
make_otf unless otf?
- make_web_friendly!
+ make_web_friendly!
make_woff unless woff?
make_eot unless eot?
make_svg unless svg?
@@ -264,13 +264,13 @@ def subset!(selections=false)
script = File.read(SUBSET_SCRIPT_PATH)
# Assign unicode values to all glyphs.
- u = selections.map{ |c|
+ u = selections.map{ |c|
uni = "0x" + c.to_i.to_s(16)
[ "SelectIf(", uni, ");", "SetUnicodeValue(", uni, ");"].join('')
}.join("\n");
- # Add gylphs to selection.
- s = selections.map{ |c|
+ # Add gylphs to selection.
+ s = selections.map{ |c|
uni = "0x" + c.to_i.to_s(16)
[ "SelectMoreIf(", uni, ");" ].join('')
}.join("\n");
@@ -318,7 +318,7 @@ def make_svgs
def make_css
css = File.read(FONT_EXPORT_TEMPLATE_PATH)
-
+
css_family = FP::Database.data[:settings][:use_font_family] ? family : fontname
css.gsub!('[family]', css_family)
@@ -347,10 +347,10 @@ def write_metadata(data)
end
def base_metadata
- {
- :timestamp => Time.now().strftime('%A, %B %l, %Y'),
- :name => name,
- :id => id
+ {
+ :timestamp => Time.now().strftime('%A, %B %l, %Y'),
+ :name => name,
+ :id => id
}
end
@@ -367,7 +367,7 @@ def cleanup_afm
def destroy!
FileUtils.rm_rf( File.join(TRASH_PATH,rawname) ) if File.exists?(File.join(TRASH_PATH,rawname))
FileUtils.mv(path, TRASH_PATH, :force => true)
- end
+ end
def install!
path = ttf_clean? ? ttf_path_clean : ttf_path
@@ -376,16 +376,16 @@ def install!
def self.all
fonts = {}
- Dir.entries( GENERATED_PATH ).select do |dir|
- next if ['.', '..'].include?(dir)
- next if !File.directory?(File.join(GENERATED_PATH, dir))
+ Dir.entries( GENERATED_PATH ).select do |dir|
+ next if ['.', '..'].include?(dir)
+ next if !File.directory?(File.join(GENERATED_PATH, dir))
font = InstalledFont.new(dir)
next if !font.metadata?
fonts[font.id] = font
end
- fonts
+ fonts
end
def self.all_as_array
@@ -393,7 +393,7 @@ def self.all_as_array
a = a.sort{ |a,b|
b_name = b.display_name.downcase
a_name = a.display_name.downcase
- a_name <=> b_name
+ a_name <=> b_name
}
a
end
@@ -422,10 +422,10 @@ def blacklisted?
def with_path(dir, keep_ttf=true, keep_ttf_clean=false, &block)
make_ttf_clean unless ttf_clean?
old_base = base
- ttf = ttf_path
- ttf_c = ttf_path_clean
+ ttf = ttf_path
+ ttf_c = ttf_path_clean
- @base = dir
+ @base = dir
FileUtils.cp ttf, base
FileUtils.cp ttf_c, base
@@ -470,9 +470,9 @@ def style
@style = 'normal'
if normalized_name =~ /italic/ or normalized_fontname =~ /italic/
- @style = "italic"
+ @style = "italic"
elsif normalized_name =~ /oblique/ or normalized_fontname =~ /oblique/
- @style = "oblique"
+ @style = "oblique"
end
set_data(:style, @style)
diff --git a/fontprep/server/external/scripts/webfont b/fontprep/server/external/scripts/webfont
deleted file mode 100644
index 24affd5..0000000
--- a/fontprep/server/external/scripts/webfont
+++ /dev/null
@@ -1,50 +0,0 @@
-# webfonts.pe font-in.ttf font-out.ttf
-
-# Generates webfont-ready files as per http://goo.gl/0qowi
-# Author: Brian Zick
-# Version: 1
-# Date: 27 September 2011
-/*
-
-DESCRIPTION
- webfonts.pe saves a source file, cleans glyph outlines, coverts to tt outlines,
- and hints fonts before saving hinted and unhinted variants in both .sfd and .ttf.
- You may need to change the path variable in this script for your project;
- by default it is set to ../Release.
-
-BUGS
- Some functions are used twice in a row. This is because they
- (for some reason) did not work properly when used once.
-
- On my system, the generated *-TTF-hints.ttf has no hints? I don't know why.
- *-TTF-hints.sfd does, however, have hints. A workaround was found by
- Alexei Vanyashin : split the script into two
- parts - one with hints, one without.
-
- I have not found a way to set "Really use Typo Metrics", and reportedly,
- fontforge doesn't export it to the TTF files anyway.
-
- It would be nice if fontforge could create a sub-folder for each version.
-
-TODO
- Options to enable or disable hinted/not hinted versions.
-*/
-
-Open($1)
-
-# Glyph cleanup
- SelectAll()
- UnlinkReference()
- RemoveOverlap()
- CorrectDirection()
- ScaleToEm(2048)
-
-# Convert splines to quadratic
- SetFontOrder(2)
- Simplify(128,2.05)
- Simplify(128,2.05)
- RoundToInt()
- RoundToInt()
-
-# Save.
-Generate($2)
\ No newline at end of file
diff --git a/fontprep/server/external/scripts/webfont.pe b/fontprep/server/external/scripts/webfont.pe
new file mode 100644
index 0000000..0d0bc00
--- /dev/null
+++ b/fontprep/server/external/scripts/webfont.pe
@@ -0,0 +1,49 @@
+# webfonts.pe font-in.ttf font-out.ttf
+
+# Generates webfont-ready files as per http://goo.gl/0qowi
+# Author: Brian Zick
+# Version: 1
+# Date: 27 September 2011
+
+
+# DESCRIPTION
+# webfonts.pe saves a source file, cleans glyph outlines, coverts to tt outlines,
+# and hints fonts before saving hinted and unhinted variants in both .sfd and .ttf.
+# You may need to change the path variable in this script for your project;
+# by default it is set to ../Release.
+#
+# BUGS
+# Some functions are used twice in a row. This is because they
+# (for some reason) did not work properly when used once.
+#
+# On my system, the generated *-TTF-hints.ttf has no hints? I don't know why.
+# *-TTF-hints.sfd does, however, have hints. A workaround was found by
+# Alexei Vanyashin : split the script into two
+# parts - one with hints, one without.
+#
+# I have not found a way to set "Really use Typo Metrics", and reportedly,
+# fontforge doesn't export it to the TTF files anyway.
+#
+# It would be nice if fontforge could create a sub-folder for each version.
+#
+# TODO
+# Options to enable or disable hinted/not hinted versions.
+
+Open($1)
+
+# Glyph cleanup
+ SelectAll()
+ UnlinkReference()
+ RemoveOverlap()
+ CorrectDirection()
+ ScaleToEm(2048)
+
+# Convert splines to quadratic
+ SetFontOrder(2)
+ Simplify(128,2.05)
+ Simplify(128,2.05)
+ RoundToInt()
+ RoundToInt()
+
+# Save.
+Generate($2)
\ No newline at end of file