ttfunk 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +114 -0
- data/{README.rdoc → README.md} +12 -8
- data/lib/ttfunk.rb +27 -21
- data/lib/ttfunk/collection.rb +41 -0
- data/lib/ttfunk/directory.rb +10 -4
- data/lib/ttfunk/encoding/mac_roman.rb +50 -40
- data/lib/ttfunk/encoding/windows_1252.rb +28 -22
- data/lib/ttfunk/reader.rb +11 -10
- data/lib/ttfunk/resource_file.rb +28 -21
- data/lib/ttfunk/subset.rb +5 -5
- data/lib/ttfunk/subset/base.rb +66 -38
- data/lib/ttfunk/subset/mac_roman.rb +11 -10
- data/lib/ttfunk/subset/unicode.rb +10 -8
- data/lib/ttfunk/subset/unicode_8bit.rb +16 -16
- data/lib/ttfunk/subset/windows_1252.rb +16 -15
- data/lib/ttfunk/subset_collection.rb +7 -8
- data/lib/ttfunk/table.rb +3 -5
- data/lib/ttfunk/table/cmap.rb +13 -13
- data/lib/ttfunk/table/cmap/format00.rb +8 -10
- data/lib/ttfunk/table/cmap/format04.rb +37 -32
- data/lib/ttfunk/table/cmap/format06.rb +16 -16
- data/lib/ttfunk/table/cmap/format10.rb +22 -17
- data/lib/ttfunk/table/cmap/format12.rb +28 -22
- data/lib/ttfunk/table/cmap/subtable.rb +30 -23
- data/lib/ttfunk/table/glyf.rb +13 -11
- data/lib/ttfunk/table/glyf/compound.rb +13 -10
- data/lib/ttfunk/table/glyf/simple.rb +5 -4
- data/lib/ttfunk/table/head.rb +13 -13
- data/lib/ttfunk/table/hhea.rb +13 -13
- data/lib/ttfunk/table/hmtx.rb +23 -18
- data/lib/ttfunk/table/kern.rb +57 -48
- data/lib/ttfunk/table/kern/format0.rb +18 -10
- data/lib/ttfunk/table/loca.rb +9 -9
- data/lib/ttfunk/table/maxp.rb +9 -9
- data/lib/ttfunk/table/name.rb +65 -56
- data/lib/ttfunk/table/os2.rb +21 -21
- data/lib/ttfunk/table/post.rb +32 -32
- data/lib/ttfunk/table/post/format10.rb +33 -27
- data/lib/ttfunk/table/post/format20.rb +10 -10
- data/lib/ttfunk/table/post/format30.rb +5 -5
- data/lib/ttfunk/table/post/format40.rb +3 -3
- data/lib/ttfunk/table/sbix.rb +19 -10
- metadata +55 -32
- metadata.gz.sig +0 -0
- data/CHANGELOG +0 -5
- data/data/fonts/DejaVuSans.ttf +0 -0
- data/examples/metrics.rb +0 -45
metadata.gz.sig
ADDED
Binary file
|
data/CHANGELOG
DELETED
data/data/fonts/DejaVuSans.ttf
DELETED
Binary file
|
data/examples/metrics.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require_relative "../lib/ttfunk"
|
3
|
-
|
4
|
-
def character_lookup(file, character)
|
5
|
-
puts "character : #{character}"
|
6
|
-
|
7
|
-
character_code = character.unpack("U*").first
|
8
|
-
puts "character code: #{character_code}"
|
9
|
-
|
10
|
-
glyph_id = file.cmap.unicode.first[character_code]
|
11
|
-
puts "glyph id : #{glyph_id}"
|
12
|
-
|
13
|
-
glyph = file.glyph_outlines.for(glyph_id)
|
14
|
-
puts "glyph type : %s" % glyph.class.name.split(/::/).last.downcase
|
15
|
-
puts "glyph size : %db" % glyph.raw.length
|
16
|
-
puts "glyph bbox : (%d,%d)-(%d,%d)" % [glyph.x_min, glyph.y_min, glyph.x_max, glyph.y_max]
|
17
|
-
|
18
|
-
if glyph.compound?
|
19
|
-
puts "components : %d %s" % [glyph.glyph_ids.length, glyph.glyph_ids.inspect]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
file = TTFunk::File.open(ARGV.first || "#{File.dirname(__FILE__)}/../data/fonts/DejaVuSans.ttf")
|
24
|
-
|
25
|
-
puts "-- FONT ------------------------------------"
|
26
|
-
|
27
|
-
puts "revision : %08x" % file.header.font_revision
|
28
|
-
puts "name : #{file.name.font_name.join(', ')}"
|
29
|
-
puts "family : #{file.name.font_family.join(', ')}"
|
30
|
-
puts "subfamily : #{file.name.font_subfamily.join(', ')}"
|
31
|
-
puts "postscript: #{file.name.postscript_name}"
|
32
|
-
|
33
|
-
puts "-- FONT METRICS ----------------------------"
|
34
|
-
|
35
|
-
puts "units/em : #{file.header.units_per_em}"
|
36
|
-
puts "ascent : #{file.ascent}"
|
37
|
-
puts "descent : #{file.descent}"
|
38
|
-
puts "line gap : #{file.line_gap}"
|
39
|
-
puts "bbox : (%d,%d)-(%d,%d)" % file.bbox
|
40
|
-
|
41
|
-
puts "-- SIMPLE CHARACTER -> GLYPH LOOKUP --------"
|
42
|
-
character_lookup(file, "\xE2\x98\x9C")
|
43
|
-
|
44
|
-
puts "-- COMPOUND CHARACTER -> GLYPH LOOKUP ------"
|
45
|
-
character_lookup(file, "ë")
|