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