Class: Postscript::Model::Operators::Font::Stringwidth
- Inherits:
-
Postscript::Model::Operator
- Object
- Postscript::Model::Operator
- Postscript::Model::Operators::Font::Stringwidth
- Defined in:
- lib/postscript/model/operators/font.rb
Overview
Returns the width of text under the current font (in
thousandths of a unit, divided by 1000). The visitor
pushes [x, y] onto the stack.
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text:) ⇒ Stringwidth
constructor
A new instance of Stringwidth.
Methods inherited from Postscript::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(text:) ⇒ Stringwidth
Returns a new instance of Stringwidth.
93 94 95 96 |
# File 'lib/postscript/model/operators/font.rb', line 93 def initialize(text:) @text = text freeze end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
92 93 94 |
# File 'lib/postscript/model/operators/font.rb', line 92 def text @text end |
Class Method Details
.from_operands(stack) ⇒ Object
97 98 99 |
# File 'lib/postscript/model/operators/font.rb', line 97 def self.from_operands(stack) new(text: stack.pop) end |