Skip to content

Releases: WeirdMath/SwiftyHaru

0.3.0

24 Dec 19:13
Compare
Choose a tag to compare
0.3.0 Pre-release
Pre-release

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 the PDFDocument.addPage(_:) family of methods. This is because multiple calls of PDFPage.draw(_:) resulted in redundant drawing operations (when resetting the context to the default state before each call). To migrate, merge your multiple calls of PDFPage.draw(_:) to one call of PDFDocument.addPage(_:). Pay attention that because of this the DrawingContext.textLeading property 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 the PDFPage's properties from the drawing closure, use the DrawingContext.page property.
  • PDFPage.draw(object:position:) and PDFPage.draw(object:x:y:) are removed. Use the DrawingContext.draw(_:position:) and DrawingContext.draw(_:x:y:) methods instead.
  • DashStyle.pattern and DashStyle.phase are now let, since changing those values wasn't in any way validated.
  • Vector is now a separate type, not a typealias for Point. Its intefrace has slightly changed: the fields have been renamed from x and y to dx and dy. This new type includes some arithmetic operators that make its use simpler.
  • The required method draw(in:position:) of the Drawable protocol is marked throws.
  • PDFDocument.setEncryptionMode(to:) and PDFDocument.setPermissions(to:) are removed. Use the PDFDocument.setPassword(owner:user:permissions:encryptionMode:) method instead.
  • DrawingContext.withNewGState(_:) doesn't throw if its argument doesn't. Same for DrawingContext.clip(to:rule:_:). If the graphics state stack depth exceeds static DrawingContext.maxGraphicsStateDepth, a precondition failure occures.
  • static PDFError.exceedGStateLimit is removed.

Implemented features:

  • AffineTransform struct 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 Hashable for many types.
  • Improved debug descriptions for Color and the geometric types.

0.2.0

25 Jun 16:43
Compare
Choose a tag to compare
0.2.0 Pre-release
Pre-release

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:) and DrawingContext.clip(to:evenOddRule:_:) methods. Instead of Bool value for fill rule they now require the Path.FillRule enum value.

Closed issues:

  • Implement high-level grid drawing #6
  • Package has unsupported layout for linux #7

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, font and fontSize of DrawingContext, width and height of PDFPage to an invalid value now causes precondition failure.
  • Many more.

0.1.0

02 Nov 20:23
Compare
Choose a tag to compare
0.1.0 Pre-release
Pre-release

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