ttfunk 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +114 -0
  5. data/{README.rdoc → README.md} +12 -8
  6. data/lib/ttfunk.rb +27 -21
  7. data/lib/ttfunk/collection.rb +41 -0
  8. data/lib/ttfunk/directory.rb +10 -4
  9. data/lib/ttfunk/encoding/mac_roman.rb +50 -40
  10. data/lib/ttfunk/encoding/windows_1252.rb +28 -22
  11. data/lib/ttfunk/reader.rb +11 -10
  12. data/lib/ttfunk/resource_file.rb +28 -21
  13. data/lib/ttfunk/subset.rb +5 -5
  14. data/lib/ttfunk/subset/base.rb +66 -38
  15. data/lib/ttfunk/subset/mac_roman.rb +11 -10
  16. data/lib/ttfunk/subset/unicode.rb +10 -8
  17. data/lib/ttfunk/subset/unicode_8bit.rb +16 -16
  18. data/lib/ttfunk/subset/windows_1252.rb +16 -15
  19. data/lib/ttfunk/subset_collection.rb +7 -8
  20. data/lib/ttfunk/table.rb +3 -5
  21. data/lib/ttfunk/table/cmap.rb +13 -13
  22. data/lib/ttfunk/table/cmap/format00.rb +8 -10
  23. data/lib/ttfunk/table/cmap/format04.rb +37 -32
  24. data/lib/ttfunk/table/cmap/format06.rb +16 -16
  25. data/lib/ttfunk/table/cmap/format10.rb +22 -17
  26. data/lib/ttfunk/table/cmap/format12.rb +28 -22
  27. data/lib/ttfunk/table/cmap/subtable.rb +30 -23
  28. data/lib/ttfunk/table/glyf.rb +13 -11
  29. data/lib/ttfunk/table/glyf/compound.rb +13 -10
  30. data/lib/ttfunk/table/glyf/simple.rb +5 -4
  31. data/lib/ttfunk/table/head.rb +13 -13
  32. data/lib/ttfunk/table/hhea.rb +13 -13
  33. data/lib/ttfunk/table/hmtx.rb +23 -18
  34. data/lib/ttfunk/table/kern.rb +57 -48
  35. data/lib/ttfunk/table/kern/format0.rb +18 -10
  36. data/lib/ttfunk/table/loca.rb +9 -9
  37. data/lib/ttfunk/table/maxp.rb +9 -9
  38. data/lib/ttfunk/table/name.rb +65 -56
  39. data/lib/ttfunk/table/os2.rb +21 -21
  40. data/lib/ttfunk/table/post.rb +32 -32
  41. data/lib/ttfunk/table/post/format10.rb +33 -27
  42. data/lib/ttfunk/table/post/format20.rb +10 -10
  43. data/lib/ttfunk/table/post/format30.rb +5 -5
  44. data/lib/ttfunk/table/post/format40.rb +3 -3
  45. data/lib/ttfunk/table/sbix.rb +19 -10
  46. metadata +55 -32
  47. metadata.gz.sig +0 -0
  48. data/CHANGELOG +0 -5
  49. data/data/fonts/DejaVuSans.ttf +0 -0
  50. data/examples/metrics.rb +0 -45
metadata.gz.sig ADDED
Binary file
data/CHANGELOG DELETED
@@ -1,5 +0,0 @@
1
- v1.0.2 (8 August 2011)
2
- * Fix Ruby 1.9.2 segmentation fault on Enumerable#zip(range) [Lucas Florio]
3
-
4
- v1.0.0 (XX February 2011)
5
- * initial release as a standalone gem
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, "ë")