use core::cell::UnsafeCell;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use crate::*;
#[doc(alias = "CTGlyphInfoRef")]
#[repr(C)]
pub struct CTGlyphInfo {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl CTGlyphInfo {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__CTGlyphInfo"> for CTGlyphInfo {}
);
unsafe impl ConcreteType for CTGlyphInfo {
#[doc(alias = "CTGlyphInfoGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn CTGlyphInfoGetTypeID() -> CFTypeID;
}
unsafe { CTGlyphInfoGetTypeID() }
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CTCharacterCollection(pub u16);
impl CTCharacterCollection {
#[doc(alias = "kCTCharacterCollectionIdentityMapping")]
pub const IdentityMapping: Self = Self(0);
#[doc(alias = "kCTCharacterCollectionAdobeCNS1")]
pub const AdobeCNS1: Self = Self(1);
#[doc(alias = "kCTCharacterCollectionAdobeGB1")]
pub const AdobeGB1: Self = Self(2);
#[doc(alias = "kCTCharacterCollectionAdobeJapan1")]
pub const AdobeJapan1: Self = Self(3);
#[doc(alias = "kCTCharacterCollectionAdobeJapan2")]
pub const AdobeJapan2: Self = Self(4);
#[doc(alias = "kCTCharacterCollectionAdobeKorea1")]
pub const AdobeKorea1: Self = Self(5);
#[deprecated = "Deprecated"]
pub const kCTIdentityMappingCharacterCollection: Self =
Self(CTCharacterCollection::IdentityMapping.0);
#[deprecated = "Deprecated"]
pub const kCTAdobeCNS1CharacterCollection: Self = Self(CTCharacterCollection::AdobeCNS1.0);
#[deprecated = "Deprecated"]
pub const kCTAdobeGB1CharacterCollection: Self = Self(CTCharacterCollection::AdobeGB1.0);
#[deprecated = "Deprecated"]
pub const kCTAdobeJapan1CharacterCollection: Self = Self(CTCharacterCollection::AdobeJapan1.0);
#[deprecated = "Deprecated"]
pub const kCTAdobeJapan2CharacterCollection: Self = Self(CTCharacterCollection::AdobeJapan2.0);
#[deprecated = "Deprecated"]
pub const kCTAdobeKorea1CharacterCollection: Self = Self(CTCharacterCollection::AdobeKorea1.0);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CTCharacterCollection {
const ENCODING: Encoding = u16::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CTCharacterCollection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl CTGlyphInfo {
#[doc(alias = "CTGlyphInfoCreateWithGlyphName")]
#[cfg(feature = "CTFont")]
#[inline]
pub unsafe fn with_glyph_name(
glyph_name: &CFString,
font: &CTFont,
base_string: &CFString,
) -> Option<CFRetained<CTGlyphInfo>> {
extern "C-unwind" {
fn CTGlyphInfoCreateWithGlyphName(
glyph_name: &CFString,
font: &CTFont,
base_string: &CFString,
) -> Option<NonNull<CTGlyphInfo>>;
}
let ret = unsafe { CTGlyphInfoCreateWithGlyphName(glyph_name, font, base_string) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CTGlyphInfoCreateWithGlyph")]
#[cfg(all(feature = "CTFont", feature = "objc2-core-graphics"))]
#[inline]
pub unsafe fn with_glyph(
glyph: CGGlyph,
font: &CTFont,
base_string: &CFString,
) -> Option<CFRetained<CTGlyphInfo>> {
extern "C-unwind" {
fn CTGlyphInfoCreateWithGlyph(
glyph: CGGlyph,
font: &CTFont,
base_string: &CFString,
) -> Option<NonNull<CTGlyphInfo>>;
}
let ret = unsafe { CTGlyphInfoCreateWithGlyph(glyph, font, base_string) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CTGlyphInfoCreateWithCharacterIdentifier")]
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe fn with_character_identifier(
cid: CGFontIndex,
collection: CTCharacterCollection,
base_string: &CFString,
) -> Option<CFRetained<CTGlyphInfo>> {
extern "C-unwind" {
fn CTGlyphInfoCreateWithCharacterIdentifier(
cid: CGFontIndex,
collection: CTCharacterCollection,
base_string: &CFString,
) -> Option<NonNull<CTGlyphInfo>>;
}
let ret = unsafe { CTGlyphInfoCreateWithCharacterIdentifier(cid, collection, base_string) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CTGlyphInfoGetGlyphName")]
#[inline]
pub unsafe fn glyph_name(&self) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CTGlyphInfoGetGlyphName(glyph_info: &CTGlyphInfo) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CTGlyphInfoGetGlyphName(self) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[doc(alias = "CTGlyphInfoGetGlyph")]
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe fn glyph(&self) -> CGGlyph {
extern "C-unwind" {
fn CTGlyphInfoGetGlyph(glyph_info: &CTGlyphInfo) -> CGGlyph;
}
unsafe { CTGlyphInfoGetGlyph(self) }
}
#[doc(alias = "CTGlyphInfoGetCharacterIdentifier")]
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe fn character_identifier(&self) -> CGFontIndex {
extern "C-unwind" {
fn CTGlyphInfoGetCharacterIdentifier(glyph_info: &CTGlyphInfo) -> CGFontIndex;
}
unsafe { CTGlyphInfoGetCharacterIdentifier(self) }
}
#[doc(alias = "CTGlyphInfoGetCharacterCollection")]
#[inline]
pub unsafe fn character_collection(&self) -> CTCharacterCollection {
extern "C-unwind" {
fn CTGlyphInfoGetCharacterCollection(glyph_info: &CTGlyphInfo)
-> CTCharacterCollection;
}
unsafe { CTGlyphInfoGetCharacterCollection(self) }
}
}
#[cfg(feature = "CTFont")]
#[deprecated = "renamed to `CTGlyphInfo::with_glyph_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithGlyphName(
glyph_name: &CFString,
font: &CTFont,
base_string: &CFString,
) -> Option<CFRetained<CTGlyphInfo>> {
extern "C-unwind" {
fn CTGlyphInfoCreateWithGlyphName(
glyph_name: &CFString,
font: &CTFont,
base_string: &CFString,
) -> Option<NonNull<CTGlyphInfo>>;
}
let ret = unsafe { CTGlyphInfoCreateWithGlyphName(glyph_name, font, base_string) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(all(feature = "CTFont", feature = "objc2-core-graphics"))]
#[deprecated = "renamed to `CTGlyphInfo::with_glyph`"]
#[inline]
pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithGlyph(
glyph: CGGlyph,
font: &CTFont,
base_string: &CFString,
) -> Option<CFRetained<CTGlyphInfo>> {
extern "C-unwind" {
fn CTGlyphInfoCreateWithGlyph(
glyph: CGGlyph,
font: &CTFont,
base_string: &CFString,
) -> Option<NonNull<CTGlyphInfo>>;
}
let ret = unsafe { CTGlyphInfoCreateWithGlyph(glyph, font, base_string) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CTGlyphInfo::with_character_identifier`"]
#[inline]
pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithCharacterIdentifier(
cid: CGFontIndex,
collection: CTCharacterCollection,
base_string: &CFString,
) -> Option<CFRetained<CTGlyphInfo>> {
extern "C-unwind" {
fn CTGlyphInfoCreateWithCharacterIdentifier(
cid: CGFontIndex,
collection: CTCharacterCollection,
base_string: &CFString,
) -> Option<NonNull<CTGlyphInfo>>;
}
let ret = unsafe { CTGlyphInfoCreateWithCharacterIdentifier(cid, collection, base_string) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `CTGlyphInfo::glyph_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTGlyphInfoGetGlyphName(
glyph_info: &CTGlyphInfo,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CTGlyphInfoGetGlyphName(glyph_info: &CTGlyphInfo) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CTGlyphInfoGetGlyphName(glyph_info) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
extern "C-unwind" {
#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CTGlyphInfo::glyph`"]
pub fn CTGlyphInfoGetGlyph(glyph_info: &CTGlyphInfo) -> CGGlyph;
}
extern "C-unwind" {
#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CTGlyphInfo::character_identifier`"]
pub fn CTGlyphInfoGetCharacterIdentifier(glyph_info: &CTGlyphInfo) -> CGFontIndex;
}
extern "C-unwind" {
#[deprecated = "renamed to `CTGlyphInfo::character_collection`"]
pub fn CTGlyphInfoGetCharacterCollection(glyph_info: &CTGlyphInfo) -> CTCharacterCollection;
}