Class: Fontist::FontFile
- Inherits:
-
Object
- Object
- Fontist::FontFile
- Defined in:
- lib/fontist/font_file.rb
Constant Summary collapse
- PLATFORM_MACINTOSH =
1
- PLATFORM_MICROSOFT =
3
- ENCODING_MAC_ROMAN =
0
- ENCODING_MS_UNICODE_BMP =
1
- LANGUAGE_MAC_ENGLISH =
0
- LANGUAGE_MS_ENGLISH_AMERICAN =
0x409
Class Method Summary collapse
- .from_collection_index(collection, index) ⇒ Object
- .from_content(content) ⇒ Object
- .from_path(path) ⇒ Object
Instance Method Summary collapse
- #family ⇒ Object
- #full_name ⇒ Object
-
#initialize(ttfunk_file) ⇒ FontFile
constructor
A new instance of FontFile.
- #preferred_family ⇒ Object
- #preferred_subfamily ⇒ Object
- #subfamily ⇒ Object
Constructor Details
#initialize(ttfunk_file) ⇒ FontFile
Returns a new instance of FontFile.
49 50 51 |
# File 'lib/fontist/font_file.rb', line 49 def initialize(ttfunk_file) @file = ttfunk_file end |
Class Method Details
.from_collection_index(collection, index) ⇒ Object
25 26 27 |
# File 'lib/fontist/font_file.rb', line 25 def from_collection_index(collection, index) new(build_font_from_collection_index(collection, index)) end |
.from_content(content) ⇒ Object
21 22 23 |
# File 'lib/fontist/font_file.rb', line 21 def from_content(content) new(build_font(content)) end |
.from_path(path) ⇒ Object
15 16 17 18 19 |
# File 'lib/fontist/font_file.rb', line 15 def from_path(path) content = File.read(path, mode: "rb") from_content(content) end |
Instance Method Details
#family ⇒ Object
57 58 59 |
# File 'lib/fontist/font_file.rb', line 57 def family english_name(main_name.font_family) end |
#full_name ⇒ Object
53 54 55 |
# File 'lib/fontist/font_file.rb', line 53 def full_name english_name(main_name.font_name) end |
#preferred_family ⇒ Object
65 66 67 68 69 |
# File 'lib/fontist/font_file.rb', line 65 def preferred_family return if main_name.preferred_family.empty? english_name(main_name.preferred_family) end |
#preferred_subfamily ⇒ Object
71 72 73 74 75 |
# File 'lib/fontist/font_file.rb', line 71 def preferred_subfamily return if main_name.preferred_subfamily.empty? english_name(main_name.preferred_subfamily) end |
#subfamily ⇒ Object
61 62 63 |
# File 'lib/fontist/font_file.rb', line 61 def subfamily english_name(main_name.font_subfamily) end |