-
Notifications
You must be signed in to change notification settings - Fork 688
MasterChangelog
TODO:
- Double check ttfunk / pdf-core for relevant changes.
- Merge #773
- Copy changes onto release tags in Github (back import to 1.0, too)
This page contains notes about features and fixes that will be shipped in future releases. For notes on already released Prawn versions, see our regular CHANGELOG.
Keep in mind that no decisions on these changes are final until we actually cut a release, but do try out new features and fixes and tell us what you think about them!
In complex Prawn-based documents, it is a common pattern to create subclasses of Prawn::Document
to isolate different components from one another, or to provide some customized rendering methods. However, the sprawling nature of the Prawn::Document
object makes this an unsafe practice: it implements hundreds of methods and contains dozens of instance variables, all of which can conflict with any subclass functionality.
Prawn::View
provides a safer alternative by using object composition instead of inheritance. This will keep your state and methods separate from Prawn’s internals, while still allowing you to directly call any methods provided by the Prawn::Document
object.
Here’s an example of Prawn::View
in use:
class Greeter
include Prawn::View
def initialize(name)
@name = name
end
def say_hello
text "Hello, #{@name}!"
end
def say_goodbye
font("Courier") do
text "Goodbye, #{@name}!"
end
end
end
greeter = Greeter.new("Gregory")
greeter.say_hello
greeter.say_goodbye
greeter.save_as("greetings.pdf")
Wherever possible, please convert your Prawn::Document
subclasses to use Prawn::View
instead. It is much less invasive, and is nearly a drop-in replacement for the existing common practice.
A bug in TTFunk prevented certain fonts from being used because they contained unsupported character map information. In most cases, this information would only be needed to render a handful of obscure glyphs,
and so most users would never run into issues by using them.
This issue has been resolved, and should help improve compatibility for CJK-based fonts in particular.
(TTFunk #20 — Dan Allen)
Some minor issues in our TTFunk dependency was causing many warnings to be generated upon loading Prawn. As of this release, you should now be able to run Ruby with warnings on and see no warnings generated from Prawn or its dependencies.
(TTFunk #21 — Jesse Doyle)