objc2_core_text/generated/
CTGlyphInfo.rs1use core::cell::UnsafeCell;
4use core::marker::{PhantomData, PhantomPinned};
5use core::ptr::NonNull;
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8use objc2_core_foundation::*;
9#[cfg(feature = "objc2-core-graphics")]
10use objc2_core_graphics::*;
11
12use crate::*;
13
14#[repr(C)]
16pub struct CTGlyphInfo {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22 #[encoding_name = "__CTGlyphInfo"]
23 unsafe impl CTGlyphInfo {}
24);
25
26unsafe impl ConcreteType for CTGlyphInfo {
27 #[doc(alias = "CTGlyphInfoGetTypeID")]
29 #[inline]
30 fn type_id() -> CFTypeID {
31 extern "C-unwind" {
32 fn CTGlyphInfoGetTypeID() -> CFTypeID;
33 }
34 unsafe { CTGlyphInfoGetTypeID() }
35 }
36}
37
38#[repr(transparent)]
62#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
63pub struct CTCharacterCollection(pub u16);
64impl CTCharacterCollection {
65 #[doc(alias = "kCTCharacterCollectionIdentityMapping")]
66 pub const IdentityMapping: Self = Self(0);
67 #[doc(alias = "kCTCharacterCollectionAdobeCNS1")]
68 pub const AdobeCNS1: Self = Self(1);
69 #[doc(alias = "kCTCharacterCollectionAdobeGB1")]
70 pub const AdobeGB1: Self = Self(2);
71 #[doc(alias = "kCTCharacterCollectionAdobeJapan1")]
72 pub const AdobeJapan1: Self = Self(3);
73 #[doc(alias = "kCTCharacterCollectionAdobeJapan2")]
74 pub const AdobeJapan2: Self = Self(4);
75 #[doc(alias = "kCTCharacterCollectionAdobeKorea1")]
76 pub const AdobeKorea1: Self = Self(5);
77 #[deprecated = "Deprecated"]
78 pub const kCTIdentityMappingCharacterCollection: Self =
79 Self(CTCharacterCollection::IdentityMapping.0);
80 #[deprecated = "Deprecated"]
81 pub const kCTAdobeCNS1CharacterCollection: Self = Self(CTCharacterCollection::AdobeCNS1.0);
82 #[deprecated = "Deprecated"]
83 pub const kCTAdobeGB1CharacterCollection: Self = Self(CTCharacterCollection::AdobeGB1.0);
84 #[deprecated = "Deprecated"]
85 pub const kCTAdobeJapan1CharacterCollection: Self = Self(CTCharacterCollection::AdobeJapan1.0);
86 #[deprecated = "Deprecated"]
87 pub const kCTAdobeJapan2CharacterCollection: Self = Self(CTCharacterCollection::AdobeJapan2.0);
88 #[deprecated = "Deprecated"]
89 pub const kCTAdobeKorea1CharacterCollection: Self = Self(CTCharacterCollection::AdobeKorea1.0);
90}
91
92#[cfg(feature = "objc2")]
93unsafe impl Encode for CTCharacterCollection {
94 const ENCODING: Encoding = u16::ENCODING;
95}
96
97#[cfg(feature = "objc2")]
98unsafe impl RefEncode for CTCharacterCollection {
99 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
100}
101
102#[cfg(feature = "CTFont")]
121#[inline]
122pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithGlyphName(
123 glyph_name: &CFString,
124 font: &CTFont,
125 base_string: &CFString,
126) -> Option<CFRetained<CTGlyphInfo>> {
127 extern "C-unwind" {
128 fn CTGlyphInfoCreateWithGlyphName(
129 glyph_name: &CFString,
130 font: &CTFont,
131 base_string: &CFString,
132 ) -> Option<NonNull<CTGlyphInfo>>;
133 }
134 let ret = unsafe { CTGlyphInfoCreateWithGlyphName(glyph_name, font, base_string) };
135 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
136}
137
138#[cfg(all(feature = "CTFont", feature = "objc2-core-graphics"))]
157#[inline]
158pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithGlyph(
159 glyph: CGGlyph,
160 font: &CTFont,
161 base_string: &CFString,
162) -> Option<CFRetained<CTGlyphInfo>> {
163 extern "C-unwind" {
164 fn CTGlyphInfoCreateWithGlyph(
165 glyph: CGGlyph,
166 font: &CTFont,
167 base_string: &CFString,
168 ) -> Option<NonNull<CTGlyphInfo>>;
169 }
170 let ret = unsafe { CTGlyphInfoCreateWithGlyph(glyph, font, base_string) };
171 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
172}
173
174#[cfg(feature = "objc2-core-graphics")]
193#[inline]
194pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithCharacterIdentifier(
195 cid: CGFontIndex,
196 collection: CTCharacterCollection,
197 base_string: &CFString,
198) -> Option<CFRetained<CTGlyphInfo>> {
199 extern "C-unwind" {
200 fn CTGlyphInfoCreateWithCharacterIdentifier(
201 cid: CGFontIndex,
202 collection: CTCharacterCollection,
203 base_string: &CFString,
204 ) -> Option<NonNull<CTGlyphInfo>>;
205 }
206 let ret = unsafe { CTGlyphInfoCreateWithCharacterIdentifier(cid, collection, base_string) };
207 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
208}
209
210#[inline]
222pub unsafe extern "C-unwind" fn CTGlyphInfoGetGlyphName(
223 glyph_info: &CTGlyphInfo,
224) -> Option<CFRetained<CFString>> {
225 extern "C-unwind" {
226 fn CTGlyphInfoGetGlyphName(glyph_info: &CTGlyphInfo) -> Option<NonNull<CFString>>;
227 }
228 let ret = unsafe { CTGlyphInfoGetGlyphName(glyph_info) };
229 ret.map(|ret| unsafe { CFRetained::retain(ret) })
230}
231
232extern "C-unwind" {
233 #[cfg(feature = "objc2-core-graphics")]
245 pub fn CTGlyphInfoGetGlyph(glyph_info: &CTGlyphInfo) -> CGGlyph;
246}
247
248extern "C-unwind" {
249 #[cfg(feature = "objc2-core-graphics")]
261 pub fn CTGlyphInfoGetCharacterIdentifier(glyph_info: &CTGlyphInfo) -> CGFontIndex;
262}
263
264extern "C-unwind" {
265 pub fn CTGlyphInfoGetCharacterCollection(glyph_info: &CTGlyphInfo) -> CTCharacterCollection;
280}