Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Add support for CGContextSetTextDrawingMode #60

Merged
merged 1 commit into from
Oct 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ use std::mem;
use std::ptr;
use std::slice;

#[repr(C)]
pub enum CGTextDrawingMode {
CGTextFill,
CGTextStroke,
CGTextFillStroke,
CGTextInvisible,
CGTextFillClip,
CGTextStrokeClip,
CGTextClip
}

#[repr(C)]
pub struct __CGContext;

Expand Down Expand Up @@ -149,6 +160,12 @@ impl CGContext {
CGContextSetShouldAntialias(self.as_concrete_TypeRef(), should_antialias)
}
}

pub fn set_text_drawing_mode(&self, mode: CGTextDrawingMode) {
unsafe {
CGContextSetTextDrawingMode(self.as_concrete_TypeRef(), mode)
}
}
}

#[link(name = "ApplicationServices", kind = "framework")]
Expand All @@ -170,6 +187,7 @@ extern {
fn CGContextSetShouldSmoothFonts(c: CGContextRef, shouldSmoothFonts: bool);
fn CGContextSetAllowsAntialiasing(c: CGContextRef, allowsAntialiasing: bool);
fn CGContextSetShouldAntialias(c: CGContextRef, shouldAntialias: bool);
fn CGContextSetTextDrawingMode(c: CGContextRef, mode: CGTextDrawingMode);
fn CGContextSetRGBFillColor(context: CGContextRef,
red: CGFloat,
green: CGFloat,
Expand Down