pub struct CTFontCollection { /* private fields */ }
CTFontCollection
only.Expand description
This is toll-free bridged with NSFontCollection
.
Implementations§
Source§impl CTFontCollection
impl CTFontCollection
Sourcepub unsafe fn from_available_fonts(
options: Option<&CFDictionary>,
) -> CFRetained<CTFontCollection>
pub unsafe fn from_available_fonts( options: Option<&CFDictionary>, ) -> CFRetained<CTFontCollection>
Returns a new font collection matching all available fonts.
Parameter options
: The options dictionary. See constant option keys.
Returns: This function creates a new collection containing all fonts available to the current application.
§Safety
options
generics must be of the correct type.
Sourcepub unsafe fn with_font_descriptors(
query_descriptors: Option<&CFArray>,
options: Option<&CFDictionary>,
) -> CFRetained<CTFontCollection>
pub unsafe fn with_font_descriptors( query_descriptors: Option<&CFArray>, options: Option<&CFDictionary>, ) -> CFRetained<CTFontCollection>
Returns a new collection based on the array of font descriptors.
Parameter queryDescriptors
: An array of font descriptors to use for matching. May be NULL, in which case the matching descriptors will be NULL.
Parameter options
: The options dictionary. See constant option keys.
Returns: This function creates a new collection based on the provided font descriptors. The contents of this collection is defined by matching the provided descriptors against all available font descriptors.
§Safety
query_descriptors
generic must be of the correct type.options
generics must be of the correct type.
Sourcepub unsafe fn copy_with_font_descriptors(
&self,
query_descriptors: Option<&CFArray>,
options: Option<&CFDictionary>,
) -> CFRetained<CTFontCollection>
pub unsafe fn copy_with_font_descriptors( &self, query_descriptors: Option<&CFArray>, options: Option<&CFDictionary>, ) -> CFRetained<CTFontCollection>
Returns a copy of the original collection augmented with the new font descriptors.
Parameter original
: The original font collection reference.
Parameter queryDescriptors
: An array of font descriptors to augment those of the original collection.
Parameter options
: The options dictionary. See constant option keys.
Returns: This function creates a copy of the original font collection augmented by the new font descriptors and options. The new font descriptors are merged with the existing descriptors to create a single set.
§Safety
query_descriptors
generic must be of the correct type.options
generics must be of the correct type.
Source§impl CTFontCollection
impl CTFontCollection
Sourcepub unsafe fn query_descriptors(&self) -> Option<CFRetained<CFArray>>
pub unsafe fn query_descriptors(&self) -> Option<CFRetained<CFArray>>
Returns the array of descriptors to match.
Parameter collection
: The font collection reference.
Returns: This function returns a retained reference to the array of descriptors to be used to query (match) the system font database. The return value is undefined if CTFontCollectionCreateFromAvailableFonts was used to create the collection.
Source§impl CTFontCollection
impl CTFontCollection
Sourcepub unsafe fn exclusion_descriptors(&self) -> Option<CFRetained<CFArray>>
pub unsafe fn exclusion_descriptors(&self) -> Option<CFRetained<CFArray>>
Returns the array of descriptors to exclude from the match.
Parameter collection
: The font collection reference.
Returns: This function returns a retained reference to the array of descriptors to be used to query (match) the system font database.
Source§impl CTFontCollection
impl CTFontCollection
Sourcepub unsafe fn matching_font_descriptors(&self) -> Option<CFRetained<CFArray>>
pub unsafe fn matching_font_descriptors(&self) -> Option<CFRetained<CFArray>>
Returns an array of font descriptors matching the collection.
Parameter collection
: The font collection reference.
Returns: An array of CTFontDescriptors matching the collection definition or NULL if there are none.
Sourcepub unsafe fn matching_font_descriptors_sorted_with_callback(
&self,
sort_callback: CTFontCollectionSortDescriptorsCallback,
ref_con: *mut c_void,
) -> Option<CFRetained<CFArray>>
Available on crate feature CTFontDescriptor
only.
pub unsafe fn matching_font_descriptors_sorted_with_callback( &self, sort_callback: CTFontCollectionSortDescriptorsCallback, ref_con: *mut c_void, ) -> Option<CFRetained<CFArray>>
CTFontDescriptor
only.Returns the array of matching font descriptors sorted with the callback function.
Parameter collection
: The collection reference.
Parameter sortCallback
: The sorting callback function that defines the sort order.
Parameter refCon
: Pointer to client data define context for the callback.
Returns: An array of CTFontDescriptors matching the criteria of the collection, sorted by the results of the sorting callback function, or NULL if there are none.
§Safety
sort_callback
must be implemented correctly.ref_con
must be a valid pointer or null.
Sourcepub unsafe fn matching_font_descriptors_with_options(
&self,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CFArray>>
pub unsafe fn matching_font_descriptors_with_options( &self, options: Option<&CFDictionary>, ) -> Option<CFRetained<CFArray>>
Returns an array of font descriptors matching the collection.
Parameter collection
: The font collection reference.
Parameter options
: The options dictionary. See constant option keys. May be NULL, in which case this call returns the same results as CTFontCollectionCreateMatchingFontDescriptors, using the options passed in when the collection was created.
Returns: An array of CTFontDescriptors matching the collection definition or NULL if there are none.
§Safety
options
generics must be of the correct type.
Sourcepub unsafe fn matching_font_descriptors_for_family(
&self,
family_name: &CFString,
options: Option<&CFDictionary>,
) -> Option<CFRetained<CFArray>>
pub unsafe fn matching_font_descriptors_for_family( &self, family_name: &CFString, options: Option<&CFDictionary>, ) -> Option<CFRetained<CFArray>>
Returns an array of font descriptors matching the specified family, one descriptor for each style in the collection.
Parameter collection
: The font collection reference.
Parameter familyName
: The font family name
Returns: An array of CTFontDescriptors matching the specified family in the collection or NULL if there are none.
§Safety
options
generics must be of the correct type.
Source§impl CTFontCollection
impl CTFontCollection
Sourcepub unsafe fn font_attribute(
&self,
attribute_name: &CFString,
options: CTFontCollectionCopyOptions,
) -> CFRetained<CFArray>
pub unsafe fn font_attribute( &self, attribute_name: &CFString, options: CTFontCollectionCopyOptions, ) -> CFRetained<CFArray>
Returns an array of font descriptor attribute values.
Parameter collection
: The font collection reference.
Parameter attributeName
: The attribute to retrieve for each descriptor in the collection.
Parameter options
: Options to alter the return value.
Returns: An array containing one value for each descriptor. With kCTFontCollectionCopyDefaultOptions, the values will be in the same order as the results from CTFontCollectionCreateMatchingFontDescriptors and NULL values will be transformed to kCFNull. When the kCTFontCollectionCopyUnique is set, duplicate values will be removed. When kCTFontCollectionCopyStandardSort is set, the values will be sorted in standard UI order.
Sourcepub unsafe fn font_attributes(
&self,
attribute_names: &CFSet,
options: CTFontCollectionCopyOptions,
) -> CFRetained<CFArray>
pub unsafe fn font_attributes( &self, attribute_names: &CFSet, options: CTFontCollectionCopyOptions, ) -> CFRetained<CFArray>
Returns an array of dictionaries containing font descriptor attribute values.
Parameter collection
: The font collection reference.
Parameter attributeNames
: The attributes to retrieve for each descriptor in the collection.
Parameter options
: Options to alter the return value.
Returns: An array containing one CFDictionary value for each descriptor mapping the requested attribute names. With kCTFontCollectionCopyDefaultOptions, the values will be in the same order as the results from CTFontCollectionCreateMatchingFontDescriptors. When the kCTFontCollectionCopyUnique is set, duplicate values will be removed. When kCTFontCollectionCopyStandardSort is set, the values will be sorted in standard UI order.
§Safety
attribute_names
generic must be of the correct type.
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
Attempt to downcast the type to that of type T
.
This is the reference-variant. Use CFRetained::downcast
if you
want to convert a retained type. See also ConcreteType
for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumber
s, small CFString
s etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX
in that case.
Trait Implementations§
Source§impl AsRef<AnyObject> for CTFontCollection
impl AsRef<AnyObject> for CTFontCollection
Source§impl AsRef<CFType> for CTFontCollection
impl AsRef<CFType> for CTFontCollection
Source§impl AsRef<CTFontCollection> for CTFontCollection
impl AsRef<CTFontCollection> for CTFontCollection
Source§impl AsRef<CTFontCollection> for CTMutableFontCollection
impl AsRef<CTFontCollection> for CTMutableFontCollection
Source§fn as_ref(&self) -> &CTFontCollection
fn as_ref(&self) -> &CTFontCollection
Source§impl Borrow<AnyObject> for CTFontCollection
impl Borrow<AnyObject> for CTFontCollection
Source§impl Borrow<CFType> for CTFontCollection
impl Borrow<CFType> for CTFontCollection
Source§impl Borrow<CTFontCollection> for CTMutableFontCollection
impl Borrow<CTFontCollection> for CTMutableFontCollection
Source§fn borrow(&self) -> &CTFontCollection
fn borrow(&self) -> &CTFontCollection
Source§impl ConcreteType for CTFontCollection
impl ConcreteType for CTFontCollection
Source§impl Debug for CTFontCollection
impl Debug for CTFontCollection
Source§impl Deref for CTFontCollection
impl Deref for CTFontCollection
Source§impl Hash for CTFontCollection
impl Hash for CTFontCollection
Source§impl Message for CTFontCollection
impl Message for CTFontCollection
Source§impl PartialEq for CTFontCollection
impl PartialEq for CTFontCollection
Source§impl RefEncode for CTFontCollection
impl RefEncode for CTFontCollection
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for CTFontCollection
impl Type for CTFontCollection
Source§fn retain(&self) -> CFRetained<Self>where
Self: Sized,
fn retain(&self) -> CFRetained<Self>where
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation
crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation
crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation
crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation
crate. Read more