Skip to content

Commit

Permalink
upgrade to Tamsyn v1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Mar 21, 2012
1 parent d41d39c commit 5a05bf3
Show file tree
Hide file tree
Showing 12 changed files with 1,600 additions and 117 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Expand Up @@ -2,7 +2,7 @@ Tamzen font
=========== ===========


This is [my personal fork][1] of the wonderful [Tamsyn font][2] by Scott Fial. This is [my personal fork][1] of the wonderful [Tamsyn font][2] by Scott Fial.
It is programatically forked from Tamsyn version 1.8 by the `Tamzen.rb` script It is programatically forked from Tamsyn version 1.9 by the `Tamzen.rb` script
(needs `gem install grit` library) and diverges from it in the following ways: (needs `gem install grit` library) and diverges from it in the following ways:


* Medium "g" is backported from Tamsyn 1.6. * Medium "g" is backported from Tamsyn 1.6.
Expand Down
57 changes: 33 additions & 24 deletions Tamzen.rb
Expand Up @@ -18,35 +18,44 @@ def to_s


require 'grit' require 'grit'
GIT = Grit::Repo.new('.') GIT = Grit::Repo.new('.')
GIT.tree('v1.8').blobs.each do |blob| GIT.tree('v1.9').blobs.each do |blob|
if blob.name =~ /\.bdf$/ if blob.name =~ /\.bdf$/
font = Font.new(blob) begin
font = Font.new(blob)


# delete empty glyphs except space and non-breaking space # delete empty glyphs except space and non-breaking space
font.chars.each do |code, char| font.chars.each do |code, char|
if code != 32 && code != 160 && char =~ /BITMAP\n(?:00\n)+ENDCHAR/ if code != 32 && code != 160 && char =~ /BITMAP\n(?:00\n)+ENDCHAR/
font.chars.delete code font.chars.delete code
end
end end
end


# backport characters from older versions of the font # backport characters from older versions of the font
[ [
['g'.ord, /Medium/, 'v1.6'], ['g'.ord, /Medium/, 'v1.6'],
['h'.ord, /Medium/, 'v1.6'], ['h'.ord, /Medium/, 'v1.6'],
['m'.ord, /Medium/, 'v1.6'], ['m'.ord, /Medium/, 'v1.6'],
['l'.ord, //, 'v1.6'], ['l'.ord, //, 'v1.6'],
['w'.ord, //, 'v1.6'], ['w'.ord, //, 'v1.6'],
['y'.ord, //, 'v1.6'], ['y'.ord, //, 'v1.6'],
]. ].
each do |code, weight, version| each do |code, weight, version|
if font.props['WEIGHT_NAME'] =~ weight if font.props['WEIGHT_NAME'] =~ weight
old = Font.new(GIT.tree(version)/font.file) if old_blob = GIT.tree(version) / font.file
font.chars[code] = old.chars[code] old_font = Font.new(old_blob)
font.chars[code] = old_font.chars[code]
else
raise "version #{version} lacks #{font.file}"
end
end
end end
end


# output the modified font under a different name # output the modified font under a different name
rename = ['Tamsyn', 'Tamzen'] rename = ['Tamsyn', 'Tamzen']
File.write font.file.sub(*rename), font.to_s.gsub(*rename) File.write font.file.sub(*rename), font.to_s.gsub(*rename)

rescue => error
warn "#{$0}: could not fork #{blob.name}: #{error}"
end
end end
end end

0 comments on commit 5a05bf3

Please sign in to comment.