fontina 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66a5e7e91b5b29fff080ff45bb59349ca07baf9b
4
- data.tar.gz: 0973241dd78cbce62b7abff045b392c42db5acbf
3
+ metadata.gz: 2f01e78cf2aa5f82dea6f070a3022a7a2130845f
4
+ data.tar.gz: 44dde365403669fb6949e7e529fc86f7476fb5ce
5
5
  SHA512:
6
- metadata.gz: 30b24eb50c609b51e14e8a592635a37ced368bbed49c1605fdd50b0da14bc07be0c13252e121dd83911ade051ee5dda0626a141843201c3a5d80cd6c9b7099f0
7
- data.tar.gz: 1a452c8bc2791749578b5f8f31a79ec11dc12d4438bbb909b1dc538ef5d482294224ef32f0b758bf967ebfa766e0bf7dd5c3579203e070b97321ceca980ad07a
6
+ metadata.gz: fe8a6882169d9e72100c09dd5ba0cb41a80039b74f9cf29880e421ab1332f25370d0bdb95ac485cad0fb24b4a528f7433f229ab7999ec04affc41076783bdb49
7
+ data.tar.gz: 755834007fd8cf8987e81f9b0d86754a59eec77700c354afa3ab27e0b1368cf49c83507cd3718a5014550776cae6cd71347a4a2dc37d7ba0184d19e4adfe2e5a
@@ -1,18 +1,18 @@
1
1
  module Fontina
2
-
2
+
3
3
  module Formats::OpenType
4
4
  OT_VERSION = 0x4f54544f # OTTO
5
5
  TT_VERSION = 0x00010000
6
6
 
7
7
  FW_NORMAL = 400
8
8
  FW_BOLD = 700
9
-
9
+
10
10
  PLATFORMS = {
11
11
  0 => :unicode,
12
12
  1 => :mac,
13
13
  3 => :windows,
14
14
  }.freeze
15
-
15
+
16
16
  ENCODINGS = {
17
17
  unicode: {
18
18
  0 => :unicode_1_0,
@@ -20,7 +20,7 @@ module Fontina
20
20
  3 => :unicode_2_0_bmp,
21
21
  4 => :unicode_2_0,
22
22
  }.freeze,
23
-
23
+
24
24
  mac: {
25
25
  0 => :roman,
26
26
  1 => :japanese,
@@ -56,19 +56,19 @@ module Fontina
56
56
  31 => :sindhi,
57
57
  32 => :uninterpreted,
58
58
  }.freeze,
59
-
59
+
60
60
  windows: {
61
61
  0 => :symbol,
62
- 1 => :unicode_ucs2_bmp,
63
- 2 => :shift_jis,
64
- 3 => :prc,
65
- 4 => :big5,
62
+ 1 => Encoding::UCS_2BE,
63
+ 2 => Encoding::Shift_JIS,
64
+ 3 => Encoding::GBK,
65
+ 4 => Encoding::Big5,
66
66
  5 => :wansung,
67
67
  6 => :johab,
68
- 10 => :unicode_ucs4,
68
+ 10 => Encoding::UCS_4BE,
69
69
  }.freeze,
70
70
  }.freeze
71
-
71
+
72
72
  LANGUAGES = {
73
73
  unicode: { 0 => nil }.freeze,
74
74
  mac: { 0xffff => nil }.merge!(LanguageCodes::MAC).freeze,
@@ -15,7 +15,7 @@ module Fontina::Formats::OpenType
15
15
  uint16 :offs
16
16
 
17
17
  delayed_io :string, read_abs_offset: -> { addr + string_offs + offs } do
18
- string length: :len
18
+ e_string length: :len, encoding: -> { encoding.value if encoding.value.is_a? Encoding }
19
19
  end
20
20
  end
21
21
 
@@ -16,6 +16,7 @@ module Fontina
16
16
  %w[
17
17
  ../language_codes/mac
18
18
  ../language_codes/windows
19
+ shared/e_string
19
20
  open_type/constants
20
21
  open_type/name_table
21
22
  open_type/head_table
@@ -0,0 +1,11 @@
1
+ module Fontina::Formats::Shared
2
+
3
+ class EString < BinData::String
4
+ mandatory_parameter :encoding
5
+
6
+ def snapshot
7
+ super.tap { |s| e = eval_parameter(:encoding) and s.force_encoding e }
8
+ end
9
+ end
10
+
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Fontina
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Petter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2017-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -161,6 +161,7 @@ files:
161
161
  - lib/fontina/formats/open_type/os2_table.rb
162
162
  - lib/fontina/formats/open_type/table.rb
163
163
  - lib/fontina/formats/open_type/table_directory.rb
164
+ - lib/fontina/formats/shared/e_string.rb
164
165
  - lib/fontina/formats/shared/p_string.rb
165
166
  - lib/fontina/language_codes/mac.rb
166
167
  - lib/fontina/language_codes/windows.rb