-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add orientation:{portrait/landscape} parameter to .pageformat
- Loading branch information
Showing
5 changed files
with
98 additions
and
35 deletions.
There are no files selected for viewing
11 changes: 7 additions & 4 deletions
11
core/src/main/kotlin/eu/iamgio/quarkdown/document/DocumentType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package eu.iamgio.quarkdown.document | ||
|
||
import eu.iamgio.quarkdown.document.page.PageOrientation | ||
|
||
/** | ||
* Type of produced document, which affects its post-rendering stage. | ||
* @param preferredOrientation the preferred orientation of the document, to apply if not overridden by the user | ||
*/ | ||
enum class DocumentType { | ||
enum class DocumentType(val preferredOrientation: PageOrientation) { | ||
/** | ||
* A document whose rendered content is not altered by the post-rendering stage. | ||
* Plain Markdown is often used as plain (e.g. READMEs). | ||
*/ | ||
PLAIN, | ||
PLAIN(PageOrientation.PORTRAIT), | ||
|
||
/** | ||
* A document that is split into pages of mostly text content: books, articles, papers, etc. | ||
*/ | ||
PAGED, | ||
PAGED(PageOrientation.PORTRAIT), | ||
|
||
/** | ||
* A slides-based document for presentations. | ||
*/ | ||
SLIDES, | ||
SLIDES(PageOrientation.LANDSCAPE), | ||
} |
23 changes: 23 additions & 0 deletions
23
core/src/main/kotlin/eu/iamgio/quarkdown/document/page/BoundingBox.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package eu.iamgio.quarkdown.document.page | ||
|
||
/** | ||
* A generic bounding box with a width and a height. | ||
*/ | ||
data class BoundingBox( | ||
val width: Size, | ||
val height: Size, | ||
) { | ||
/** | ||
* A 90-degrees rotated version of this bounding box, | ||
* which happens to be a new [BoundingBox] with the height and width swapped. | ||
*/ | ||
val rotated: BoundingBox | ||
get() = BoundingBox(height, width) | ||
} | ||
|
||
/** | ||
* Shorthand for creating a [BoundingBox] from two [Size]s. | ||
* @param height height of the bounding box | ||
* @return a new [BoundingBox] with [this] width and the given [height] | ||
*/ | ||
infix fun Size.by(height: Size) = BoundingBox(this, height) |
16 changes: 16 additions & 0 deletions
16
core/src/main/kotlin/eu/iamgio/quarkdown/document/page/PageOrientation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package eu.iamgio.quarkdown.document.page | ||
|
||
/** | ||
* The orientation of a page. | ||
*/ | ||
enum class PageOrientation { | ||
/** | ||
* Vertical orientation, where `height >= width` | ||
*/ | ||
PORTRAIT, | ||
|
||
/** | ||
* Horizontal orientation, where `width > height` | ||
*/ | ||
LANDSCAPE, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters