Class: TTFunk::Table::Name::NameString

Inherits:
String
  • Object
show all
Defined in:
lib/ttfunk/table/name.rb

Overview

Name Record.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, platform_id, encoding_id, language_id) ⇒ NameString

Returns a new instance of NameString.

Parameters:

  • text (String)
  • platform_id (Integer)
  • encoding_id (Integer)
  • language_id (Integer)


28
29
30
31
32
33
# File 'lib/ttfunk/table/name.rb', line 28

def initialize(text, platform_id, encoding_id, language_id)
  super(text)
  @platform_id = platform_id
  @encoding_id = encoding_id
  @language_id = language_id
end

Instance Attribute Details

#encoding_idInteger (readonly)

Platform-specific encoding ID.

Returns:

  • (Integer)


18
19
20
# File 'lib/ttfunk/table/name.rb', line 18

def encoding_id
  @encoding_id
end

#language_idInteger (readonly)

Language ID.

Returns:

  • (Integer)


22
23
24
# File 'lib/ttfunk/table/name.rb', line 22

def language_id
  @language_id
end

#platform_idInteger (readonly)

Platform ID.

Returns:

  • (Integer)


14
15
16
# File 'lib/ttfunk/table/name.rb', line 14

def platform_id
  @platform_id
end

Instance Method Details

#strip_extendedString

Removes chracter incompatible with PostScript.

Returns:

  • (String)

    PostScript-compatible version of this string.



37
38
39
40
41
# File 'lib/ttfunk/table/name.rb', line 37

def strip_extended
  stripped = gsub(/[\x00-\x19\x80-\xff]/n, '')
  stripped = '[not-postscript]' if stripped.empty?
  stripped
end