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)
Source Code
lib/ttfunk/table/name.rb, line 28
28
def initialize(text, platform_id, encoding_id, language_id)
29
  super(text)
30
  @platform_id = platform_id
31
  @encoding_id = encoding_id
32
  @language_id = language_id
33
end

Instance Attribute Details

#encoding_idInteger (readonly)

Platform-specific encoding ID.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/name.rb, line 18
18
def encoding_id
19
  @encoding_id
20
end

#language_idInteger (readonly)

Language ID.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/name.rb, line 22
22
def language_id
23
  @language_id
24
end

#platform_idInteger (readonly)

Platform ID.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/name.rb, line 14
14
def platform_id
15
  @platform_id
16
end

Instance Method Details

#strip_extendedString

Removes chracter incompatible with PostScript.

Returns:

  • (String)

    PostScript-compatible version of this string.

Source Code
lib/ttfunk/table/name.rb, line 37
37
def strip_extended
38
  stripped = gsub(/[\x00-\x19\x80-\xff]/n, '')
39
  stripped = '[not-postscript]' if stripped.empty?
40
  stripped
41
end