Object
Prawn::Text::Formatted::Fragment is a state store for a formatted text fragment. It does not render anything.
# File lib/prawn/text/formatted/fragment.rb, line 193
193: def absolute_bottom
194: absolute_bounding_box[1]
195: end
# File lib/prawn/text/formatted/fragment.rb, line 205
205: def absolute_bottom_left
206: [absolute_left, absolute_bottom]
207: end
# File lib/prawn/text/formatted/fragment.rb, line 209
209: def absolute_bottom_right
210: [absolute_right, absolute_bottom]
211: end
# File lib/prawn/text/formatted/fragment.rb, line 77
77: def absolute_bounding_box
78: box = bounding_box
79: box[0] += @document.bounds.absolute_left
80: box[2] += @document.bounds.absolute_left
81: box[1] += @document.bounds.absolute_bottom
82: box[3] += @document.bounds.absolute_bottom
83: box
84: end
# File lib/prawn/text/formatted/fragment.rb, line 181
181: def absolute_left
182: absolute_bounding_box[0]
183: end
# File lib/prawn/text/formatted/fragment.rb, line 185
185: def absolute_right
186: absolute_bounding_box[2]
187: end
# File lib/prawn/text/formatted/fragment.rb, line 189
189: def absolute_top
190: absolute_bounding_box[3]
191: end
# File lib/prawn/text/formatted/fragment.rb, line 197
197: def absolute_top_left
198: [absolute_left, absolute_top]
199: end
# File lib/prawn/text/formatted/fragment.rb, line 201
201: def absolute_top_right
202: [absolute_right, absolute_top]
203: end
# File lib/prawn/text/formatted/fragment.rb, line 104
104: def anchor
105: @format_state[:anchor]
106: end
# File lib/prawn/text/formatted/fragment.rb, line 161
161: def bottom
162: baseline - descender
163: end
# File lib/prawn/text/formatted/fragment.rb, line 177
177: def bottom_left
178: [left, bottom]
179: end
# File lib/prawn/text/formatted/fragment.rb, line 173
173: def bottom_right
174: [right, bottom]
175: end
# File lib/prawn/text/formatted/fragment.rb, line 73
73: def bounding_box
74: [left, bottom, right, top]
75: end
# File lib/prawn/text/formatted/fragment.rb, line 142
142: def callback_objects
143: callback = @format_state[:callback]
144: if callback.nil?
145: []
146: elsif callback.is_a?(Array)
147: callback
148: else
149: [callback]
150: end
151: end
# File lib/prawn/text/formatted/fragment.rb, line 120
120: def character_spacing
121: @format_state[:character_spacing] ||
122: @document.character_spacing
123: end
# File lib/prawn/text/formatted/fragment.rb, line 108
108: def color
109: @format_state[:color]
110: end
# File lib/prawn/text/formatted/fragment.rb, line 129
129: def default_direction=(direction)
130: @format_state[:direction] = direction unless @format_state[:direction]
131: end
# File lib/prawn/text/formatted/fragment.rb, line 125
125: def direction
126: @format_state[:direction]
127: end
# File lib/prawn/text/formatted/fragment.rb, line 112
112: def font
113: @format_state[:font]
114: end
# File lib/prawn/text/formatted/fragment.rb, line 54
54: def height
55: top - bottom
56: end
# File lib/prawn/text/formatted/fragment.rb, line 133
133: def include_trailing_white_space!
134: @format_state.delete(:exclude_trailing_white_space)
135: end
# File lib/prawn/text/formatted/fragment.rb, line 100
100: def link
101: @format_state[:link]
102: end
# File lib/prawn/text/formatted/fragment.rb, line 153
153: def right
154: left + width
155: end
# File lib/prawn/text/formatted/fragment.rb, line 116
116: def size
117: @format_state[:size]
118: end
# File lib/prawn/text/formatted/fragment.rb, line 137
137: def space_count
138: string = exclude_trailing_white_space? ? @text.rstrip : @text
139: string.count(" ")
140: end
# File lib/prawn/text/formatted/fragment.rb, line 91
91: def strikethrough_points
92: y = baseline + ascender * 0.3
93: [[left, y], [right, y]]
94: end
# File lib/prawn/text/formatted/fragment.rb, line 96
96: def styles
97: @format_state[:styles] || []
98: end
# File lib/prawn/text/formatted/fragment.rb, line 58
58: def subscript?
59: styles.include?(:subscript)
60: end
# File lib/prawn/text/formatted/fragment.rb, line 62
62: def superscript?
63: styles.include?(:superscript)
64: end
# File lib/prawn/text/formatted/fragment.rb, line 30
30: def text
31: string = strip_zero_width_spaces(@text)
32: if exclude_trailing_white_space?
33: string = string.rstrip
34: string = process_soft_hyphens(string)
35: end
36: case direction
37: when :rtl
38: if ruby_18 { true }
39: string.scan(/./u).reverse.join
40: else
41: string.reverse
42: end
43: else
44: string
45: end
46: end
# File lib/prawn/text/formatted/fragment.rb, line 157
157: def top
158: baseline + ascender
159: end
# File lib/prawn/text/formatted/fragment.rb, line 165
165: def top_left
166: [left, top]
167: end
# File lib/prawn/text/formatted/fragment.rb, line 169
169: def top_right
170: [right, top]
171: end
# File lib/prawn/text/formatted/fragment.rb, line 86
86: def underline_points
87: y = baseline - 1.25
88: [[left, y], [right, y]]
89: end
# File lib/prawn/text/formatted/fragment.rb, line 215
215: def exclude_trailing_white_space?
216: @format_state[:exclude_trailing_white_space]
217: end
# File lib/prawn/text/formatted/fragment.rb, line 219
219: def normalized_soft_hyphen
220: @format_state[:normalized_soft_hyphen]
221: end
# File lib/prawn/text/formatted/fragment.rb, line 223
223: def process_soft_hyphens(string)
224: if string.length > 0 && normalized_soft_hyphen
225: string[0..2].gsub(normalized_soft_hyphen, "") + string[1..1]
226: else
227: string
228: end
229: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.