Class: Pdfrb::Font::TrueType::Post
- Inherits:
-
Object
- Object
- Pdfrb::Font::TrueType::Post
- Defined in:
- lib/pdfrb/font/true_type/post.rb
Constant Summary collapse
- STANDARD_GLYPH_NAMES =
%w[ .notdef .null nonmarkingreturn space exclam quotedbl numbersign dollar percent ampersand quotesingle parenleft parenright asterisk plus comma hyphen period slash zero one two three four five six seven eight nine colon semicolon less equal greater question at A B C D E F G H I J K L M N O P Q R S T U V W X Y Z bracketleft backslash bracketright asciicircum underscore grave a b c d e f g h i j k l m n o p q r s t u v w x y z braceleft bar braceright asciitilde Adieresis Aring Ccedilla Eacute Ntilde Odieresis Udieresis aacute agrave acircumflex adieresis atilde aring ccedilla eacute egrave ecircumflex edieresis iacute igrave icircumflex idieresis ntilde oacute ograve ocircumflex odieresis otilde uacute ugrave ucircumflex udieresis dagger degree cent sterling section bullet paragraph germandbls registered copyright trademark acute dieresis notequal AE Oslash infinity plusminus lessequal greaterequal yen mu partialdiff summation product pi integral ordfeminine ordmasculine Omega ae oslash questiondown exclamdown logicalnot radical florin approxequal Delta guillemotleft guillemotright ellipsis nonbreakingspace Agrave Atilde Otilde OE oe endash emdash quotedblleft quotedblright quoteleft quoteright divide lozenge ydieresis Ydieresis fraction currency guilsinglleft guilsinglright fi fl daggerdbl periodcentered quotesinglbase quotedblbase perthousand Acircumflex Ecircumflex Aacute Edieresis Egrave Iacute Icircumflex Idieresis Eth eth Yacute yacute Thorne thorn multiply minus onesuperior twosuperior threesuperior onehalf onequarter threequarters franc Gbreve gbreve Idotaccent Scedilla scedilla Cacute cacute Ccaron ccaron dcroat ].freeze
Instance Attribute Summary collapse
-
#glyph_names ⇒ Object
readonly
Returns the value of attribute glyph_names.
-
#is_fixed_pitch ⇒ Object
readonly
Returns the value of attribute is_fixed_pitch.
-
#italic_angle ⇒ Object
readonly
Returns the value of attribute italic_angle.
-
#underline_position ⇒ Object
readonly
Returns the value of attribute underline_position.
-
#underline_thickness ⇒ Object
readonly
Returns the value of attribute underline_thickness.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #glyph_name(index) ⇒ Object
-
#initialize(data) ⇒ Post
constructor
A new instance of Post.
- #s32(data, off) ⇒ Object
Constructor Details
#initialize(data) ⇒ Post
Returns a new instance of Post.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pdfrb/font/true_type/post.rb', line 10 def initialize(data) return unless data && data.bytesize >= 32 @version = data.bytes[0, 4].pack("C*").unpack1("N") @italic_angle = s32(data, 4) / 65536.0 @underline_position = s16(data, 8) @underline_thickness = s16(data, 10) @is_fixed_pitch = data.bytes[12, 4].pack("C*").unpack1("N") @glyph_names = parse_names(data) if @version == 0x00020000 end |
Instance Attribute Details
#glyph_names ⇒ Object (readonly)
Returns the value of attribute glyph_names.
7 8 9 |
# File 'lib/pdfrb/font/true_type/post.rb', line 7 def glyph_names @glyph_names end |
#is_fixed_pitch ⇒ Object (readonly)
Returns the value of attribute is_fixed_pitch.
7 8 9 |
# File 'lib/pdfrb/font/true_type/post.rb', line 7 def is_fixed_pitch @is_fixed_pitch end |
#italic_angle ⇒ Object (readonly)
Returns the value of attribute italic_angle.
7 8 9 |
# File 'lib/pdfrb/font/true_type/post.rb', line 7 def italic_angle @italic_angle end |
#underline_position ⇒ Object (readonly)
Returns the value of attribute underline_position.
7 8 9 |
# File 'lib/pdfrb/font/true_type/post.rb', line 7 def underline_position @underline_position end |
#underline_thickness ⇒ Object (readonly)
Returns the value of attribute underline_thickness.
7 8 9 |
# File 'lib/pdfrb/font/true_type/post.rb', line 7 def underline_thickness @underline_thickness end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
7 8 9 |
# File 'lib/pdfrb/font/true_type/post.rb', line 7 def version @version end |
Instance Method Details
#glyph_name(index) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/pdfrb/font/true_type/post.rb', line 21 def glyph_name(index) return nil unless @glyph_names return nil if index >= @glyph_names.length @glyph_names[index] end |
#s32(data, off) ⇒ Object
28 |
# File 'lib/pdfrb/font/true_type/post.rb', line 28 def s32(data, off); (data.getbyte(off) << 24) | (data.getbyte(off + 1) << 16) | (data.getbyte(off + 2) << 8) | data.getbyte(off + 3); end |