From 5e77c855008fdcf32cae765f309d1b00729e4912 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 3 May 2018 17:01:26 -0400 Subject: [PATCH] Expose CTFontCopyVariationAxes. WebRender uses this function so it's probably useful to expose. --- core-text/src/font.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core-text/src/font.rs b/core-text/src/font.rs index 45d8b35..a3fb15f 100644 --- a/core-text/src/font.rs +++ b/core-text/src/font.rs @@ -14,7 +14,7 @@ use font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation}; use font_descriptor::{CTFontSymbolicTraits, CTFontTraits, SymbolicTraitAccessors, TraitAccessors}; use core_foundation::array::{CFArray, CFArrayRef}; -use core_foundation::base::{CFIndex, CFOptionFlags, CFTypeID, CFTypeRef, TCFType}; +use core_foundation::base::{CFIndex, CFOptionFlags, CFType, CFTypeID, CFTypeRef, TCFType}; use core_foundation::data::{CFData, CFDataRef}; use core_foundation::dictionary::{CFDictionary, CFDictionaryRef}; use core_foundation::number::CFNumber; @@ -316,6 +316,16 @@ impl CTFont { } } + pub fn get_variation_axes(&self) -> Option>> { + unsafe { + let axes = CTFontCopyVariationAxes(self.0); + if axes.is_null() { + return None; + } + Some(TCFType::wrap_under_create_rule(axes)) + } + } + pub fn create_path_for_glyph(&self, glyph: CGGlyph, matrix: &CGAffineTransform) -> Result { unsafe { @@ -491,7 +501,7 @@ extern { //fn CTFontGetVerticalTranslationsForGlyphs /* Working With Font Variations */ - //fn CTFontCopyVariationAxes + fn CTFontCopyVariationAxes(font: CTFontRef) -> CFArrayRef; //fn CTFontCopyVariation /* Getting Font Features */