Class: PSD::LegacyTypeTool

Inherits:
TypeTool show all
Defined in:
lib/psd/layer/info/legacy_typetool.rb

Instance Attribute Summary

Attributes inherited from LayerInfo

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TypeTool

#alignment, #colors, #engine_data, #font, #fonts, #leadings, #method_missing, #parser, #sizes, #styles, #to_css, #to_hash

Methods inherited from LayerInfo

#initialize, #skip

Constructor Details

This class inherits a constructor from PSD::LayerInfo

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PSD::TypeTool

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)

6
7
8
# File 'lib/psd/layer/info/legacy_typetool.rb', line 6

def self.should_parse?(key)
  key == 'tySh'
end

Instance Method Details

#parseObject


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/psd/layer/info/legacy_typetool.rb', line 10

def parse      
  version = @file.read_short
  parse_transform_info

  # Font Information
  version = @file.read_short

  faces_count = @file.read_short
  @data[:face] = []

  faces_count.times do |i|
    @data[:face][i] = {}
    @data[:face][i][:mark] = @file.read_short
    @data[:face][i][:font_type] = @file.read_int
    @data[:face][i][:font_name] = @file.read_string
    @data[:face][i][:font_family_name] = @file.read_string
    @data[:face][i][:font_style_name] = @file.read_string
    @data[:face][i][:script] = @file.read_short
    @data[:face][i][:number_axes_vector] = @file.read_int
    @data[:face][i][:vector] = []

    @data[:face][i][:number_axes_vector].times do |j|
      @data[:face][i][:vector] << @file.read_int
    end
  end

  # Style Information
  styles_count = @file.read_short
  @data[:style] = []

  styles_count.times do |i|
    @data[:style][i] = {}
    @data[:style][i][:mark] = @file.read_short
    @data[:style][i][:face_mark] = @file.read_short
    @data[:style][i][:size] = @file.read_int
    @data[:style][i][:tracking] = @file.read_int
    @data[:style][i][:kerning] = @file.read_int
    @data[:style][i][:leading] = @file.read_int
    @data[:style][i][:base_shift] = @file.read_int
    @data[:style][i][:auto_kern] = @file.read_boolean

    # Bleh
    @file.read 1

    @data[:style][i][:rotate] = @file.read_boolean
  end

  # Text information
  @data[:type] = @file.read_short
  @data[:scaling_factor] = @file.read_int
  @data[:character_count] = @file.read_int
  @data[:horz_place] = @file.read_int
  @data[:vert_place] = @file.read_int
  @data[:select_start] = @file.read_int
  @data[:select_end] = @file.read_int

  lines_count = @file.read_short
  @data[:line] = []

  lines_count.times do |i|
    @data[:line][i] = {}
    @data[:line][i][:char_count] = @file.read_int
    @data[:line][i][:orientation] = @file.read_short
    @data[:line][i][:alignment] = @file.read_short
    @data[:line][i][:actual_char] = @file.read_short
    @data[:line][i][:style] = @file.read_short
  end

  # Color information
  @data[:color] = @file.read_space_color
  @data[:antialias] = @file.read_boolean

  return self
end

#text_valueObject

Not sure where this is stored right now


86
87
88
# File 'lib/psd/layer/info/legacy_typetool.rb', line 86

def text_value
  ""
end