Class: Archimate::DataModel::Font
- Inherits:
-
ArchimateNode
- Object
- Dry::Struct
- ArchimateNode
- Archimate::DataModel::Font
- Defined in:
- lib/archimate/data_model/font.rb
Instance Attribute Summary
Attributes inherited from ArchimateNode
#parent_attribute_name, #struct_instance_variables
Class Method Summary collapse
-
.archi_font_string(str) ⇒ Object
Archi font strings look like this: “1|Arial |14.0|0|WINDOWS|1|0 |0|0|0|0 |0 |0|0|1|0|0|0|0 |Arial” “1|Arial |8.0 |0|WINDOWS|1|0 |0|0|0|0 |0 |0|0|1|0|0|0|0 |Arial” “1|Segoe UI Semibold|12.0|2|WINDOWS|1|-16|0|0|0|600|-1|0|0|0|3|2|1|34|Segoe UI Semibold” “1|Times New Roman |12.0|3|WINDOWS|1|-16|0|0|0|700|-1|0|0|0|3|2|1|18|Times New Roman”.
Instance Method Summary collapse
-
#style_string ⇒ Object
TODO: this isn’t standard Move to file format.
- #to_archi_font ⇒ Object
- #to_s ⇒ Object
Methods inherited from ArchimateNode
#ancestors, #build_index, #clone, #compact!, #delete, #diff, #dup, #element_by_id, #id, #in_model, #in_model=, #initialize, #parent, #parent=, #path, #primitive?, #referenced_identified_nodes, #set, #with
Constructor Details
This class inherits a constructor from Archimate::DataModel::ArchimateNode
Class Method Details
.archi_font_string(str) ⇒ Object
Archi font strings look like this:
"1|Arial |14.0|0|WINDOWS|1|0 |0|0|0|0 |0 |0|0|1|0|0|0|0 |Arial"
"1|Arial |8.0 |0|WINDOWS|1|0 |0|0|0|0 |0 |0|0|1|0|0|0|0 |Arial"
"1|Segoe UI Semibold|12.0|2|WINDOWS|1|-16|0|0|0|600|-1|0|0|0|3|2|1|34|Segoe UI Semibold"
"1|Times New Roman |12.0|3|WINDOWS|1|-16|0|0|0|700|-1|0|0|0|3|2|1|18|Times New Roman"
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/archimate/data_model/font.rb', line 15 def self.archi_font_string(str) return nil if str.nil? font_parts = str.split("|") DataModel::Font.new( name: font_parts[1], size: font_parts[2], style: font_parts[3], font_data: str ) end |
Instance Method Details
#style_string ⇒ Object
TODO: this isn’t standard Move to file format
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/archimate/data_model/font.rb', line 40 def style_string case style when 1 "italic" when 2 "bold" when 3 "bold|italic" end end |
#to_archi_font ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/archimate/data_model/font.rb', line 30 def to_archi_font font_data || [ 1, font.name, font.size, font.style, "WINDOWS", 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, font.name ].map(&:to_s).join("|") end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/archimate/data_model/font.rb', line 26 def to_s "Font(name: #{name}, size: #{size}, style: #{style})" end |