forked from PureSwift/Cairo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc207ab
commit 4dab21c
Showing
19 changed files
with
159 additions
and
142 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,17 +1,51 @@ | ||
// swift-tools-version:3.0.2 | ||
// swift-tools-version:5.0 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Cairo", | ||
products: [ | ||
.library( | ||
name: "Cairo", | ||
targets: ["Cairo"]), | ||
], | ||
targets: [ | ||
Target( | ||
name: "Cairo") | ||
.target( | ||
name: "Cairo", | ||
dependencies: [ | ||
"CCairo", | ||
"CFontConfig", | ||
"CFreeType" | ||
] | ||
), | ||
.testTarget( | ||
name: "CairoTests", | ||
dependencies: [ | ||
"Cairo" | ||
] | ||
), | ||
.systemLibrary( | ||
name: "CCairo", | ||
pkgConfig: "cairo", | ||
providers: [ | ||
.brew(["cairo"]), | ||
.apt(["libcairo2-dev"]) | ||
]), | ||
.systemLibrary( | ||
name: "CFontConfig", | ||
pkgConfig: "fontconfig", | ||
providers: [ | ||
.brew(["fontconfig"]), | ||
.apt(["libfontconfig-dev"]) | ||
]), | ||
.systemLibrary( | ||
name: "CFreeType", | ||
pkgConfig: "freetype", | ||
providers: [ | ||
.brew(["freetype2"]), | ||
.apt(["libfreetype6-dev"]) | ||
]) | ||
], | ||
dependencies: [ | ||
.Package(url: "https://github.com/PureSwift/CCairo.git", majorVersion: 1), | ||
.Package(url: "https://github.com/PureSwift/CFontConfig.git", majorVersion: 1), | ||
.Package(url: "https://github.com/PureSwift/CFreeType.git", majorVersion: 1) | ||
] | ||
swiftLanguageVersions: [.v5] | ||
) |
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,10 +1,10 @@ | ||
# Cairo | ||
Cairo library for Swift | ||
|
||
## OS X Installation | ||
## macOS Installation | ||
|
||
`brew install cairo` | ||
|
||
## Ubuntu Installation | ||
## Linux Installation | ||
|
||
`sudo apt-get install libcairo2-dev` | ||
`sudo apt-get install libcairo2-dev` |
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,5 @@ | ||
module CCairo [system] { | ||
header "shim.h" | ||
link "cairo" | ||
export * | ||
} |
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,4 @@ | ||
#include <cairo.h> | ||
#include <cairo-pdf.h> | ||
#include <cairo-svg.h> | ||
#include <cairo-ft.h> |
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,5 @@ | ||
module CFontConfig [system] { | ||
header "shim.h" | ||
link "fontconfig" | ||
export * | ||
} |
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,2 @@ | ||
#include <fontconfig/fontconfig.h> | ||
#include <fontconfig/fcfreetype.h> |
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,5 @@ | ||
module CFreeType [system] { | ||
header "shim.h" | ||
link "freetype" | ||
export * | ||
} |
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,4 @@ | ||
#include <ft2build.h> | ||
#include FT_FREETYPE_H | ||
#include <freetype/freetype.h> | ||
#include <freetype/tttables.h> |
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
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,33 @@ | ||
// | ||
// QuickLook.swift | ||
// Cairo | ||
// | ||
// Created by Alsey Coleman Miller on 5/3/19. | ||
// | ||
|
||
#if os(macOS) && Xcode | ||
|
||
import Foundation | ||
import AppKit | ||
|
||
public extension Surface { | ||
|
||
@objc(debugQuickLookObject) | ||
var debugQuickLookObject: AnyObject { | ||
|
||
let filePath = NSTemporaryDirectory() + "CairoSwiftQuickLook\(UUID().uuidString).png" | ||
self.writePNG(atPath: filePath) | ||
let image = NSImage(byReferencingFile: filePath)! | ||
return image | ||
} | ||
} | ||
|
||
public extension Context { | ||
|
||
@objc(debugQuickLookObject) | ||
var debugQuickLookObject: AnyObject { | ||
return surface.debugQuickLookObject | ||
} | ||
} | ||
|
||
#endif |
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
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
Oops, something went wrong.