Releases: WeirdMath/SwiftyHaru
0.3.0
Please note that this version requires Swift 4.2.
Breaking changes:
(Those are a bit massive, sorry.)
PDFPage.draw(_:)is removed. The closure for drawing can now be passed to thePDFDocument.addPage(_:)family of methods. This is because multiple calls ofPDFPage.draw(_:)resulted in redundant drawing operations (when resetting the context to the default state before each call). To migrate, merge your multiple calls ofPDFPage.draw(_:)to one call ofPDFDocument.addPage(_:). Pay attention that because of this theDrawingContext.textLeadingproperty is initially set to 0 (not 11 like before), so you may want to change its value before doing any text operations. Also, if you need to access thePDFPage's properties from the drawing closure, use theDrawingContext.pageproperty.PDFPage.draw(object:position:)andPDFPage.draw(object:x:y:)are removed. Use theDrawingContext.draw(_:position:)andDrawingContext.draw(_:x:y:)methods instead.DashStyle.patternandDashStyle.phaseare nowlet, since changing those values wasn't in any way validated.Vectoris now a separate type, not a typealias forPoint. Its intefrace has slightly changed: the fields have been renamed fromxandytodxanddy. This new type includes some arithmetic operators that make its use simpler.- The required method
draw(in:position:)of theDrawableprotocol is markedthrows. PDFDocument.setEncryptionMode(to:)andPDFDocument.setPermissions(to:)are removed. Use thePDFDocument.setPassword(owner:user:permissions:encryptionMode:)method instead.DrawingContext.withNewGState(_:)doesn't throw if its argument doesn't. Same forDrawingContext.clip(to:rule:_:). If the graphics state stack depth exceedsstatic DrawingContext.maxGraphicsStateDepth, a precondition failure occures.static PDFError.exceedGStateLimitis removed.
Implemented features:
AffineTransformstruct that helps you easily apply transforms like rotation, scaling and translation to a document's coordinate system.- Concatenating the transformation matrix of a page + convenience methods for translation, scaling and rotation.
- Getting the current transformation matrix of a page.
- Added conformance to
Hashablefor many types. - Improved debug descriptions for
Colorand the geometric types.
0.2.0
Finally, the second version of SwiftyHaru is released!
Plenty of new features were implemented, fixed building when using SPM. Please note that this version requires Swift 3.1.
If you use CocoaPods, you'll be happy to know that we don't use CLibHaru and CLibPNG as separate pods that SwiftyHaru depends on anymore, but rather they are included in the same pod. It makes managing dependencies a bit simpler.
You can refer to the FEATURES.md file if you want to see the exact functionality of LibHaru that is present in SwiftyHaru 0.2.0.
Breaking changes:
- Changed the signature of the
DrawingContext.fill(_:evenOddRule:stroke:)andDrawingContext.clip(to:evenOddRule:_:)methods. Instead ofBoolvalue for fill rule they now require thePath.FillRuleenum value.
Closed issues:
Implemented features:
- Loading TrueType fonts from a .ttc collection
- Getting a bounding box of a specified text put at a specified position
- Getting the ascent of a font
- Getting the descent of a font
- Getting the x-height of a font
- Getting the cap height of a font
- Setting metadata (author, creator, title, subject, keywords, creation date, modification date)
- Setting a password, encryption mode and permissions
- Setting a compression mode
- Getting the depth of the graphics state stack
- Closure-based syntax for saving and restoring the graphics state
- Showing a text in a provided rectangle
- High-level customizable interface for drawing grids!
Fixes:
- Setting
miterLimit,fontandfontSizeofDrawingContext,widthandheightofPDFPageto an invalid value now causes precondition failure. - Many more.
0.1.0
The first release is here!
🎉🎉🎉
This release includes some basic functionality implemented around LibHaru. For details see FEATURES.md.
Closed issues:
- Add CocoaPods support #4
Implemented features:
- Creating PDF documents
- Saving a document's contents into binary
Data - Appending and inserting pages to documents
- Setting a page's layout
- Adding labels to pages
- Loading TrueType fonts from file
- Setting a page's size
- Rotating a page
- Measuring a width of a specified text
- Path construction
- Path painting
- Setting a font
- Setting a font size
- Setting a line width
- Setting a line cap
- Setting a line join
- Setting a miter limit
- Setting a dash style
- Setting a text leading
- Setting a stroke and fill color and color space
- Putting a text on a page