Method: Prawn::Text::Formatted::Box#initialize
- Defined in:
- lib/prawn/text/formatted/box.rb
#initialize(formatted_text, options = {}) ⇒ Box
See Prawn::Text#text_box for valid options
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/prawn/text/formatted/box.rb', line 173 def initialize(formatted_text, = {}) @inked = false Prawn.(, ) = .dup self.class.extensions.reverse_each { |e| extend(e) } @overflow = [:overflow] || :truncate @disable_wrap_by_char = [:disable_wrap_by_char] self.original_text = formatted_text @text = nil @document = [:document] @direction = [:direction] || @document.text_direction @fallback_fonts = [:fallback_fonts] || @document.fallback_fonts @at = ( [:at] || [@document.bounds.left, @document.bounds.top] ).dup @width = [:width] || (@document.bounds.right - @at[0]) @height = [:height] || default_height @align = [:align] || (@direction == :rtl ? :right : :left) @vertical_align = [:valign] || :top @leading = [:leading] || @document.default_leading @character_spacing = [:character_spacing] || @document.character_spacing @mode = [:mode] || @document.text_rendering_mode @rotate = [:rotate] || 0 @rotate_around = [:rotate_around] || :upper_left @single_line = [:single_line] @draw_text_callback = [:draw_text_callback] # if the text rendering mode is :unknown, force it back to :fill if @mode == :unknown @mode = :fill end if @overflow == :expand # if set to expand, then we simply set the bottom # as the bottom of the document bounds, since that # is the maximum we should expand to @height = default_height @overflow = :truncate end @min_font_size = [:min_font_size] || 5 if [:kerning].nil? [:kerning] = @document.default_kerning? end = { kerning: [:kerning], size: [:size], style: [:style], } super(formatted_text, ) end |