From 7971feda4f03c3ae52fa430e7e1752bb3a760134 Mon Sep 17 00:00:00 2001 From: "Brian J. Burg" Date: Fri, 19 Oct 2012 12:45:59 -0700 Subject: [PATCH] Initial commit --- .gitignore | 11 +++++++++++ Makefile.in | 23 +++++++++++++++++++++++ configure | 5 +++++ core-graphics.rc | 8 ++++++++ data_provider.rs | 16 ++++++++++++++++ font.rs | 11 +++++++++++ 6 files changed, 74 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile.in create mode 100755 configure create mode 100644 core-graphics.rc create mode 100644 data_provider.rs create mode 100644 font.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f68b7f --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*~ +*# +*.o +*.a +*.so +*.dylib +*.dSYM +*.dll +*.dummy +cocoa-test +build diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..cfc1469 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,23 @@ +VPATH=%VPATH% + +RUSTC ?= rustc +RUSTFLAGS ?= + +RUST_SRC=$(shell find $(VPATH)/. -type f -name '*.rs') + +.PHONY: all clean +all: librustcoregraphics.dummy + +librustcoregraphics.dummy: core_graphics.rc $(RUST_SRC) + $(RUSTC) $(RUSTFLAGS) $< -o $@ + touch $@ + +rustcoregraphics-test: core_graphics.rc $(RUST_SRC) + $(RUSTC) $(RUSTFLAGS) $< -o $@ --test + +check: rustcoregraphics-test + ./rustcoregraphics-test + +clean: + rm -f *.o *.a *.so *.dylib *.dll *.dummy + diff --git a/configure b/configure new file mode 100755 index 0000000..ed6c06e --- /dev/null +++ b/configure @@ -0,0 +1,5 @@ +#!/bin/bash + +SRCDIR="$(cd $(dirname $0) && pwd)" +sed "s#%VPATH%#${SRCDIR}#" ${SRCDIR}/Makefile.in > Makefile + diff --git a/core-graphics.rc b/core-graphics.rc new file mode 100644 index 0000000..1c73cc3 --- /dev/null +++ b/core-graphics.rc @@ -0,0 +1,8 @@ +#[link(name = "core_graphics", + vers = "0.1")]; +#[crate_type = "lib"]; + +extern mod std; + +pub mod data_provider; +pub mod font; \ No newline at end of file diff --git a/data_provider.rs b/data_provider.rs new file mode 100644 index 0000000..8890c1b --- /dev/null +++ b/data_provider.rs @@ -0,0 +1,16 @@ +use libc::{c_void, c_char, size_t}; + +pub type CGDataProviderRef = *c_void; +pub type CGDataProviderReleaseDataCallback = *c_void; + +#[link_args="-framework CoreGraphics"] +#[nolink] +extern { + pub fn CGDataProviderCreateWithFilename(filename: *c_char) -> CGDataProviderRef; + pub fn CGDataProviderCreateWithData(info: *c_void, + data: *c_void, + size: size_t, + releaseData: CGDataProviderReleaseDataCallback + ) -> CGDataProviderRef; + pub fn CGDataProviderRelease(provider: CGDataProviderRef); +} diff --git a/font.rs b/font.rs new file mode 100644 index 0000000..02d6a7a --- /dev/null +++ b/font.rs @@ -0,0 +1,11 @@ +use libc::{c_void, c_char, size_t}; +use data_provider::CGDataProviderRef; + +pub type CGFontRef = *c_void; + +#[link_args="-framework CoreGraphics"] +#[nolink] +extern { + pub fn CGFontCreateWithDataProvider(provider: CGDataProviderRef) -> CGFontRef; + pub fn CGFontRelease(font: CGFontRef); +}