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 unsafe impl CTGlyphInfo {}
23);
24#[cfg(feature = "objc2")]
25cf_objc2_type!(
26 unsafe impl RefEncode<"__CTGlyphInfo"> for CTGlyphInfo {}
27);
28
29unsafe impl ConcreteType for CTGlyphInfo {
30 #[doc(alias = "CTGlyphInfoGetTypeID")]
32 #[inline]
33 fn type_id() -> CFTypeID {
34 extern "C-unwind" {
35 fn CTGlyphInfoGetTypeID() -> CFTypeID;
36 }
37 unsafe { CTGlyphInfoGetTypeID() }
38 }
39}
40
41#[repr(transparent)]
65#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
66pub struct CTCharacterCollection(pub u16);
67impl CTCharacterCollection {
68 #[doc(alias = "kCTCharacterCollectionIdentityMapping")]
69 pub const IdentityMapping: Self = Self(0);
70 #[doc(alias = "kCTCharacterCollectionAdobeCNS1")]
71 pub const AdobeCNS1: Self = Self(1);
72 #[doc(alias = "kCTCharacterCollectionAdobeGB1")]
73 pub const AdobeGB1: Self = Self(2);
74 #[doc(alias = "kCTCharacterCollectionAdobeJapan1")]
75 pub const AdobeJapan1: Self = Self(3);
76 #[doc(alias = "kCTCharacterCollectionAdobeJapan2")]
77 pub const AdobeJapan2: Self = Self(4);
78 #[doc(alias = "kCTCharacterCollectionAdobeKorea1")]
79 pub const AdobeKorea1: Self = Self(5);
80 #[deprecated = "Deprecated"]
81 pub const kCTIdentityMappingCharacterCollection: Self =
82 Self(CTCharacterCollection::IdentityMapping.0);
83 #[deprecated = "Deprecated"]
84 pub const kCTAdobeCNS1CharacterCollection: Self = Self(CTCharacterCollection::AdobeCNS1.0);
85 #[deprecated = "Deprecated"]
86 pub const kCTAdobeGB1CharacterCollection: Self = Self(CTCharacterCollection::AdobeGB1.0);
87 #[deprecated = "Deprecated"]
88 pub const kCTAdobeJapan1CharacterCollection: Self = Self(CTCharacterCollection::AdobeJapan1.0);
89 #[deprecated = "Deprecated"]
90 pub const kCTAdobeJapan2CharacterCollection: Self = Self(CTCharacterCollection::AdobeJapan2.0);
91 #[deprecated = "Deprecated"]
92 pub const kCTAdobeKorea1CharacterCollection: Self = Self(CTCharacterCollection::AdobeKorea1.0);
93}
94
95#[cfg(feature = "objc2")]
96unsafe impl Encode for CTCharacterCollection {
97 const ENCODING: Encoding = u16::ENCODING;
98}
99
100#[cfg(feature = "objc2")]
101unsafe impl RefEncode for CTCharacterCollection {
102 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
103}
104
105impl CTGlyphInfo {
106 #[doc(alias = "CTGlyphInfoCreateWithGlyphName")]
125 #[cfg(feature = "CTFont")]
126 #[inline]
127 pub unsafe fn with_glyph_name(
128 glyph_name: &CFString,
129 font: &CTFont,
130 base_string: &CFString,
131 ) -> Option<CFRetained<CTGlyphInfo>> {
132 extern "C-unwind" {
133 fn CTGlyphInfoCreateWithGlyphName(
134 glyph_name: &CFString,
135 font: &CTFont,
136 base_string: &CFString,
137 ) -> Option<NonNull<CTGlyphInfo>>;
138 }
139 let ret = unsafe { CTGlyphInfoCreateWithGlyphName(glyph_name, font, base_string) };
140 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
141 }
142
143 #[doc(alias = "CTGlyphInfoCreateWithGlyph")]
162 #[cfg(all(feature = "CTFont", feature = "objc2-core-graphics"))]
163 #[inline]
164 pub unsafe fn with_glyph(
165 glyph: CGGlyph,
166 font: &CTFont,
167 base_string: &CFString,
168 ) -> Option<CFRetained<CTGlyphInfo>> {
169 extern "C-unwind" {
170 fn CTGlyphInfoCreateWithGlyph(
171 glyph: CGGlyph,
172 font: &CTFont,
173 base_string: &CFString,
174 ) -> Option<NonNull<CTGlyphInfo>>;
175 }
176 let ret = unsafe { CTGlyphInfoCreateWithGlyph(glyph, font, base_string) };
177 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
178 }
179
180 #[doc(alias = "CTGlyphInfoCreateWithCharacterIdentifier")]
199 #[cfg(feature = "objc2-core-graphics")]
200 #[inline]
201 pub unsafe fn with_character_identifier(
202 cid: CGFontIndex,
203 collection: CTCharacterCollection,
204 base_string: &CFString,
205 ) -> Option<CFRetained<CTGlyphInfo>> {
206 extern "C-unwind" {
207 fn CTGlyphInfoCreateWithCharacterIdentifier(
208 cid: CGFontIndex,
209 collection: CTCharacterCollection,
210 base_string: &CFString,
211 ) -> Option<NonNull<CTGlyphInfo>>;
212 }
213 let ret = unsafe { CTGlyphInfoCreateWithCharacterIdentifier(cid, collection, base_string) };
214 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
215 }
216
217 #[doc(alias = "CTGlyphInfoGetGlyphName")]
229 #[inline]
230 pub unsafe fn glyph_name(self: &CTGlyphInfo) -> Option<CFRetained<CFString>> {
231 extern "C-unwind" {
232 fn CTGlyphInfoGetGlyphName(glyph_info: &CTGlyphInfo) -> Option<NonNull<CFString>>;
233 }
234 let ret = unsafe { CTGlyphInfoGetGlyphName(self) };
235 ret.map(|ret| unsafe { CFRetained::retain(ret) })
236 }
237
238 #[doc(alias = "CTGlyphInfoGetGlyph")]
250 #[cfg(feature = "objc2-core-graphics")]
251 #[inline]
252 pub unsafe fn glyph(self: &CTGlyphInfo) -> CGGlyph {
253 extern "C-unwind" {
254 fn CTGlyphInfoGetGlyph(glyph_info: &CTGlyphInfo) -> CGGlyph;
255 }
256 unsafe { CTGlyphInfoGetGlyph(self) }
257 }
258
259 #[doc(alias = "CTGlyphInfoGetCharacterIdentifier")]
271 #[cfg(feature = "objc2-core-graphics")]
272 #[inline]
273 pub unsafe fn character_identifier(self: &CTGlyphInfo) -> CGFontIndex {
274 extern "C-unwind" {
275 fn CTGlyphInfoGetCharacterIdentifier(glyph_info: &CTGlyphInfo) -> CGFontIndex;
276 }
277 unsafe { CTGlyphInfoGetCharacterIdentifier(self) }
278 }
279
280 #[doc(alias = "CTGlyphInfoGetCharacterCollection")]
295 #[inline]
296 pub unsafe fn character_collection(self: &CTGlyphInfo) -> CTCharacterCollection {
297 extern "C-unwind" {
298 fn CTGlyphInfoGetCharacterCollection(glyph_info: &CTGlyphInfo)
299 -> CTCharacterCollection;
300 }
301 unsafe { CTGlyphInfoGetCharacterCollection(self) }
302 }
303}
304
305#[cfg(feature = "CTFont")]
306#[deprecated = "renamed to `CTGlyphInfo::with_glyph_name`"]
307#[inline]
308pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithGlyphName(
309 glyph_name: &CFString,
310 font: &CTFont,
311 base_string: &CFString,
312) -> Option<CFRetained<CTGlyphInfo>> {
313 extern "C-unwind" {
314 fn CTGlyphInfoCreateWithGlyphName(
315 glyph_name: &CFString,
316 font: &CTFont,
317 base_string: &CFString,
318 ) -> Option<NonNull<CTGlyphInfo>>;
319 }
320 let ret = unsafe { CTGlyphInfoCreateWithGlyphName(glyph_name, font, base_string) };
321 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
322}
323
324#[cfg(all(feature = "CTFont", feature = "objc2-core-graphics"))]
325#[deprecated = "renamed to `CTGlyphInfo::with_glyph`"]
326#[inline]
327pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithGlyph(
328 glyph: CGGlyph,
329 font: &CTFont,
330 base_string: &CFString,
331) -> Option<CFRetained<CTGlyphInfo>> {
332 extern "C-unwind" {
333 fn CTGlyphInfoCreateWithGlyph(
334 glyph: CGGlyph,
335 font: &CTFont,
336 base_string: &CFString,
337 ) -> Option<NonNull<CTGlyphInfo>>;
338 }
339 let ret = unsafe { CTGlyphInfoCreateWithGlyph(glyph, font, base_string) };
340 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
341}
342
343#[cfg(feature = "objc2-core-graphics")]
344#[deprecated = "renamed to `CTGlyphInfo::with_character_identifier`"]
345#[inline]
346pub unsafe extern "C-unwind" fn CTGlyphInfoCreateWithCharacterIdentifier(
347 cid: CGFontIndex,
348 collection: CTCharacterCollection,
349 base_string: &CFString,
350) -> Option<CFRetained<CTGlyphInfo>> {
351 extern "C-unwind" {
352 fn CTGlyphInfoCreateWithCharacterIdentifier(
353 cid: CGFontIndex,
354 collection: CTCharacterCollection,
355 base_string: &CFString,
356 ) -> Option<NonNull<CTGlyphInfo>>;
357 }
358 let ret = unsafe { CTGlyphInfoCreateWithCharacterIdentifier(cid, collection, base_string) };
359 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
360}
361
362#[deprecated = "renamed to `CTGlyphInfo::glyph_name`"]
363#[inline]
364pub unsafe extern "C-unwind" fn CTGlyphInfoGetGlyphName(
365 glyph_info: &CTGlyphInfo,
366) -> Option<CFRetained<CFString>> {
367 extern "C-unwind" {
368 fn CTGlyphInfoGetGlyphName(glyph_info: &CTGlyphInfo) -> Option<NonNull<CFString>>;
369 }
370 let ret = unsafe { CTGlyphInfoGetGlyphName(glyph_info) };
371 ret.map(|ret| unsafe { CFRetained::retain(ret) })
372}
373
374extern "C-unwind" {
375 #[cfg(feature = "objc2-core-graphics")]
376 #[deprecated = "renamed to `CTGlyphInfo::glyph`"]
377 pub fn CTGlyphInfoGetGlyph(glyph_info: &CTGlyphInfo) -> CGGlyph;
378}
379
380extern "C-unwind" {
381 #[cfg(feature = "objc2-core-graphics")]
382 #[deprecated = "renamed to `CTGlyphInfo::character_identifier`"]
383 pub fn CTGlyphInfoGetCharacterIdentifier(glyph_info: &CTGlyphInfo) -> CGFontIndex;
384}
385
386extern "C-unwind" {
387 #[deprecated = "renamed to `CTGlyphInfo::character_collection`"]
388 pub fn CTGlyphInfoGetCharacterCollection(glyph_info: &CTGlyphInfo) -> CTCharacterCollection;
389}