objc2_core_text/generated/
CTStringAttributes.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern "C" {
12    /// The font.
13    ///
14    ///
15    /// Value must be a CTFontRef. Default is Helvetica 12.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontattributename?language=objc)
18    pub static kCTFontAttributeName: &'static CFString;
19}
20
21extern "C" {
22    /// Never set a foreground color in the CGContext; use what is set as
23    /// the context's fill color.
24    ///
25    ///
26    /// Value must be a CFBooleanRef. Default is false. The reason
27    /// why this exists is because an NSAttributedString defaults to a
28    /// black color if no color attribute is set. This forces CoreText to
29    /// set the color in the context. This will allow developers to
30    /// sidestep this, making CoreText set nothing but font information
31    /// in the CGContext. If set, this attribute also determines the
32    /// color used by kCTUnderlineStyleAttributeName, in which case it
33    /// overrides the foreground color.
34    ///
35    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctforegroundcolorfromcontextattributename?language=objc)
36    pub static kCTForegroundColorFromContextAttributeName: &'static CFString;
37}
38
39extern "C" {
40    /// A kerning adjustment.
41    ///
42    ///
43    /// Value must be a CFNumberRef float. Default is standard kerning.
44    /// The kerning attribute indicate how many points the following
45    /// character should be shifted from its default offset as defined
46    /// by the current character's font in points; a positive kern
47    /// indicates a shift farther along and a negative kern indicates a
48    /// shift closer to the current character. If this attribute is not
49    /// present, standard kerning will be used. If this attribute is
50    /// set to 0.0, no kerning will be done at all.
51    ///
52    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctkernattributename?language=objc)
53    pub static kCTKernAttributeName: &'static CFString;
54}
55
56extern "C" {
57    /// Applies tracking (letterspacing).
58    ///
59    ///
60    /// Value must be a CFNumber. Default is zero (no tracking).
61    /// The tracking attribute indicates how much additional space, in
62    /// points, should be added to each character cluster after layout.
63    /// The effect of this attribute is similar to kCTKernAttributeName
64    /// but differs in that the added tracking is treated as trailing
65    /// whitespace and a non-zero amount disables non-essential ligatures
66    /// unless overridden by kCTLigatureAttributeName being present.
67    /// If both kCTKernAttributeName and kCTTrackingAttributeName are
68    /// present kCTKernAttributeName will be ignored unless zero;
69    /// kCTTrackingAttributeName will still be honored.
70    ///
71    ///
72    /// See also: kCTKernAttributeName
73    ///
74    /// See also: kCTLigatureAttributeName
75    ///
76    /// See also: CTLineGetTrailingWhitespaceWidth
77    ///
78    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kcttrackingattributename?language=objc)
79    pub static kCTTrackingAttributeName: &'static CFString;
80}
81
82extern "C" {
83    /// Controls ligature formation.
84    ///
85    ///
86    /// Value must be a CFNumberRef. Default is int value 1. The ligature
87    /// attribute determines what kinds of ligatures should be used when
88    /// displaying the string. A value of 0 indicates that only ligatures
89    /// essential for proper rendering of text should be used, 1
90    /// indicates that standard ligatures should be used, and 2 indicates
91    /// that all available ligatures should be used. Which ligatures are
92    /// standard depends on the script and possibly the font. Arabic
93    /// text, for example, requires ligatures for many character
94    /// sequences, but has a rich set of additional ligatures that
95    /// combine characters. English text has no essential ligatures, and
96    /// typically has only two standard ligatures, those for "fi" and
97    /// "fl" -- all others being considered more advanced or fancy.
98    ///
99    /// On iOS releases prior to 6.0 essential ligatures are applied
100    /// if the font contains glyphs for any of U+FB00 through U+FB04 and
101    /// the font lacks AAT or OpenType shaping tables, but as of 6.0
102    /// shaping tables (or the lack thereof) are treated as definitive.
103    ///
104    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctligatureattributename?language=objc)
105    pub static kCTLigatureAttributeName: &'static CFString;
106}
107
108extern "C" {
109    /// The foreground color.
110    ///
111    ///
112    /// Value must be a CGColorRef. Default value is black.
113    ///
114    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctforegroundcolorattributename?language=objc)
115    pub static kCTForegroundColorAttributeName: &'static CFString;
116}
117
118extern "C" {
119    /// The background color.
120    ///
121    ///
122    /// Value must be a CGColorRef. Default is no background color.
123    ///
124    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbackgroundcolorattributename?language=objc)
125    pub static kCTBackgroundColorAttributeName: &'static CFString;
126}
127
128extern "C" {
129    /// A CTParagraphStyle object which is used to specify things like
130    /// line alignment, tab rulers, writing direction, etc.
131    ///
132    ///
133    /// Value must be a CTParagraphStyleRef. Default is an empty
134    /// CTParagraphStyle object: see CTParagraphStyle.h for more
135    /// information. The value of this attribute must be uniform over
136    /// the range of any paragraphs to which it is applied.
137    ///
138    ///
139    /// See also: CFStringGetParagraphBounds
140    ///
141    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctparagraphstyleattributename?language=objc)
142    pub static kCTParagraphStyleAttributeName: &'static CFString;
143}
144
145extern "C" {
146    /// The stroke width.
147    ///
148    ///
149    /// Value must be a CFNumberRef. Default value is 0.0, or no stroke.
150    /// This attribute, interpreted as a percentage of font point size,
151    /// controls the text drawing mode: positive values effect drawing
152    /// with stroke only; negative values are for stroke and fill. A
153    /// typical value for outlined text is 3.0.
154    ///
155    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctstrokewidthattributename?language=objc)
156    pub static kCTStrokeWidthAttributeName: &'static CFString;
157}
158
159extern "C" {
160    /// The stroke color.
161    ///
162    ///
163    /// Value must be a CGColorRef. Default is the foreground color.
164    ///
165    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctstrokecolorattributename?language=objc)
166    pub static kCTStrokeColorAttributeName: &'static CFString;
167}
168
169extern "C" {
170    /// Allows the setting of an underline to be applied at render
171    /// time.
172    ///
173    ///
174    /// Value must be a CFNumberRef. Default is kCTUnderlineStyleNone.
175    /// Set a value of something other than kCTUnderlineStyleNone to draw
176    /// an underline. In addition, the CTUnderlineStyleModifiers can be
177    /// used to modify the look of the underline. The underline color
178    /// will be determined by the text's foreground color unless
179    /// otherwise specified by kCTUnderlineColorAttributeName.
180    ///
181    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctunderlinestyleattributename?language=objc)
182    pub static kCTUnderlineStyleAttributeName: &'static CFString;
183}
184
185extern "C" {
186    /// Controls vertical text positioning.
187    ///
188    ///
189    /// Value must be a CFNumberRef. Default is int value 0. If supported
190    /// by the specified font, a value of 1 enables superscripting and a
191    /// value of -1 enables subscripting.
192    ///
193    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctsuperscriptattributename?language=objc)
194    pub static kCTSuperscriptAttributeName: &'static CFString;
195}
196
197extern "C" {
198    /// The underline color.
199    ///
200    ///
201    /// Value must be a CGColorRef. Default is the foreground color.
202    ///
203    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctunderlinecolorattributename?language=objc)
204    pub static kCTUnderlineColorAttributeName: &'static CFString;
205}
206
207extern "C" {
208    /// Controls glyph orientation.
209    ///
210    ///
211    /// Value must be a CFBooleanRef. Default is false. A value of false
212    /// indicates that horizontal glyph forms are to be used, true
213    /// indicates that vertical glyph forms are to be used.
214    ///
215    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctverticalformsattributename?language=objc)
216    pub static kCTVerticalFormsAttributeName: &'static CFString;
217}
218
219extern "C" {
220    /// Setting text in tate-chu-yoko form (horizontal numerals in vertical text).
221    ///
222    ///
223    /// Value must be a CFNumberRef. Default is int value 0. A value of 1
224    /// to 4 indicates the number of digits or letters to set in horizontal
225    /// form. This is to apply the correct feature settings for the text.
226    /// This attribute only works when kCTVerticalFormsAttributeName is set
227    /// to true.
228    ///
229    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kcthorizontalinverticalformsattributename?language=objc)
230    pub static kCTHorizontalInVerticalFormsAttributeName: &'static CFString;
231}
232
233extern "C" {
234    /// Allows the use of unencoded glyphs.
235    ///
236    ///
237    /// Value must be a CTGlyphInfoRef. The glyph specified by this
238    /// CTGlyphInfo object is assigned to the entire attribute range,
239    /// provided that its contents match the specified base string and
240    /// that the specified glyph is available in the font specified by
241    /// kCTFontAttributeName. See CTGlyphInfo.h for more information.
242    ///
243    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctglyphinfoattributename?language=objc)
244    pub static kCTGlyphInfoAttributeName: &'static CFString;
245}
246
247extern "C" {
248    /// Controls glyph selection.
249    ///
250    ///
251    /// Value must be a CFNumberRef. Default is value is 0 (disabled).
252    /// A non-zero value is interpreted as an SFNT kCharacterShapeType
253    /// selector + 1; see SFNTLayoutTypes.h for selectors. For example,
254    /// an attribute value of 1 corresponds to kTraditionalCharactersSelector.
255    ///
256    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctcharactershapeattributename?language=objc)
257    #[deprecated = "Use feature type kCharacterShapeType with the appropriate selector"]
258    pub static kCTCharacterShapeAttributeName: &'static CFString;
259}
260
261extern "C" {
262    /// Specifies text language.
263    ///
264    ///
265    /// Value must be a CFStringRef containing a locale identifier. Default
266    /// is unset. When this attribute is set to a valid identifier, it will
267    /// be used to select localized glyphs (if supported by the font) and
268    /// locale-specific line breaking rules.
269    ///
270    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctlanguageattributename?language=objc)
271    pub static kCTLanguageAttributeName: &'static CFString;
272}
273
274extern "C" {
275    /// Allows customization of certain aspects of a range of text's
276    /// appearance.
277    ///
278    ///
279    /// Value must be a CTRunDelegateRef. The values returned by the
280    /// embedded object for an attribute range apply to each glyph
281    /// resulting from the text in that range. Because an embedded object
282    /// is only a display-time modification, care should be taken to
283    /// avoid applying this attribute to a range of text with complex
284    /// behavior, such as a change of writing direction, combining marks,
285    /// etc. Consequently, it is recommended that this attribute be
286    /// applied to a range containing the single character U+FFFC. See
287    /// CTRunDelegate.h for more information.
288    ///
289    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctrundelegateattributename?language=objc)
290    pub static kCTRunDelegateAttributeName: &'static CFString;
291}
292
293/// Underline style specifiers.
294///
295///
296/// These underline type specifiers can be applied to the value set
297/// with the kCTUnderlineStyleAttributeName attribute to tell
298/// CoreText that you want a different underline style.
299///
300/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctunderlinestyle?language=objc)
301// NS_OPTIONS
302#[repr(transparent)]
303#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
304pub struct CTUnderlineStyle(pub i32);
305bitflags::bitflags! {
306    impl CTUnderlineStyle: i32 {
307        #[doc(alias = "kCTUnderlineStyleNone")]
308        const None = 0x00;
309        #[doc(alias = "kCTUnderlineStyleSingle")]
310        const Single = 0x01;
311        #[doc(alias = "kCTUnderlineStyleThick")]
312        const Thick = 0x02;
313        #[doc(alias = "kCTUnderlineStyleDouble")]
314        const Double = 0x09;
315    }
316}
317
318#[cfg(feature = "objc2")]
319unsafe impl Encode for CTUnderlineStyle {
320    const ENCODING: Encoding = i32::ENCODING;
321}
322
323#[cfg(feature = "objc2")]
324unsafe impl RefEncode for CTUnderlineStyle {
325    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
326}
327
328/// Underline style modifiers.
329///
330///
331/// Set these bits with the CTUnderlineStyle that you set with the
332/// kCTUnderlineStyleAttributeName attribute to modify how the
333/// underline will be drawn.
334///
335/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctunderlinestylemodifiers?language=objc)
336// NS_OPTIONS
337#[repr(transparent)]
338#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
339pub struct CTUnderlineStyleModifiers(pub i32);
340bitflags::bitflags! {
341    impl CTUnderlineStyleModifiers: i32 {
342        #[doc(alias = "kCTUnderlinePatternSolid")]
343        const PatternSolid = 0x0000;
344        #[doc(alias = "kCTUnderlinePatternDot")]
345        const PatternDot = 0x0100;
346        #[doc(alias = "kCTUnderlinePatternDash")]
347        const PatternDash = 0x0200;
348        #[doc(alias = "kCTUnderlinePatternDashDot")]
349        const PatternDashDot = 0x0300;
350        #[doc(alias = "kCTUnderlinePatternDashDotDot")]
351        const PatternDashDotDot = 0x0400;
352    }
353}
354
355#[cfg(feature = "objc2")]
356unsafe impl Encode for CTUnderlineStyleModifiers {
357    const ENCODING: Encoding = i32::ENCODING;
358}
359
360#[cfg(feature = "objc2")]
361unsafe impl RefEncode for CTUnderlineStyleModifiers {
362    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
363}
364
365extern "C" {
366    /// Key to reference a baseline class override.
367    ///
368    ///
369    /// Value must be one of the kCTBaselineClass constants. Normally,
370    /// glyphs on the line will be assigned baseline classes according to
371    /// the 'bsln' or 'BASE' table in the font. This attribute may be
372    /// used to change this assignment.
373    ///
374    ///
375    /// See also: kCTBaselineClassRoman
376    ///
377    /// See also: kCTBaselineClassIdeographicCentered
378    ///
379    /// See also: kCTBaselineClassIdeographicLow
380    ///
381    /// See also: kCTBaselineClassIdeographicHigh
382    ///
383    /// See also: kCTBaselineClassHanging
384    ///
385    /// See also: kCTBaselineClassMath
386    ///
387    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassattributename?language=objc)
388    pub static kCTBaselineClassAttributeName: &'static CFString;
389}
390
391extern "C" {
392    /// Key to reference a baseline info dictionary.
393    ///
394    ///
395    /// Value must be a CFDictionaryRef. Normally, baseline offsets will
396    /// be assigned based on the 'bsln' or 'BASE' table in the font. This
397    /// attribute may be used to assign different offsets. Each key in
398    /// the dictionary is one of the kCTBaselineClass constants and the
399    /// value is a CFNumberRef of the baseline offset in points. You only
400    /// need to specify the offsets you wish to change.
401    ///
402    ///
403    /// See also: kCTBaselineClassRoman
404    ///
405    /// See also: kCTBaselineClassIdeographicCentered
406    ///
407    /// See also: kCTBaselineClassIdeographicLow
408    ///
409    /// See also: kCTBaselineClassIdeographicHigh
410    ///
411    /// See also: kCTBaselineClassHanging
412    ///
413    /// See also: kCTBaselineClassMath
414    ///
415    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineinfoattributename?language=objc)
416    pub static kCTBaselineInfoAttributeName: &'static CFString;
417}
418
419extern "C" {
420    /// Key to reference a baseline info dictionary for the reference baseline.
421    ///
422    ///
423    /// Value must be a CFDictionaryRef. All glyphs in a run are assigned
424    /// a baseline class and then aligned to the offset for that class in
425    /// the reference baseline baseline info. See the discussion of
426    /// kCTBaselineInfoAttributeName for information about the contents
427    /// of the dictionary. You can also use the kCTBaselineReferenceFont
428    /// key to specify that the baseline offsets of a particular
429    /// CTFontRef should be used as the reference offsets.
430    ///
431    ///
432    /// See also: kCTBaselineClassRoman
433    ///
434    /// See also: kCTBaselineClassIdeographicCentered
435    ///
436    /// See also: kCTBaselineClassIdeographicLow
437    ///
438    /// See also: kCTBaselineClassIdeographicHigh
439    ///
440    /// See also: kCTBaselineClassHanging
441    ///
442    /// See also: kCTBaselineClassMath
443    ///
444    /// See also: kCTBaselineReferenceFont
445    ///
446    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselinereferenceinfoattributename?language=objc)
447    pub static kCTBaselineReferenceInfoAttributeName: &'static CFString;
448}
449
450extern "C" {
451    /// Controls vertical text positioning.
452    ///
453    ///
454    /// Value must be a CFNumberRef float. Default is standard positioning.
455    /// The baseline attribute indicates how many points the characters
456    /// should be shifted perpendicular to their baseline. A positive
457    /// baseline value indicates a shift above (or to the right for vertical
458    /// text) the text baseline and a negative baseline value indicates a
459    /// shift below (or to the left for vertical text) the text baseline.
460    /// If this value is set to 0.0, no baseline shift will be performed.
461    ///
462    ///
463    /// See also: NSBaselineOffsetAttributeName
464    ///
465    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineoffsetattributename?language=objc)
466    pub static kCTBaselineOffsetAttributeName: &'static CFString;
467}
468
469extern "C" {
470    /// Specifies a bidirectional override or embedding.
471    ///
472    ///
473    /// Value must be a CFArray of CFNumberRefs, each of which should
474    /// have a value of either kCTWritingDirectionLeftToRight or
475    /// kCTWritingDirectionRightToLeft, plus one of
476    /// kCTWritingDirectionEmbedding or kCTWritingDirectionOverride.
477    /// This array represents a sequence of nested bidirectional
478    /// embeddings or overrides, in order from outermost to innermost,
479    /// with (kCTWritingDirectionLeftToRight | kCTWritingDirectionEmbedding)
480    /// corresponding to a LRE/PDF pair in plain text or
481    /// <span dir="ltr">
482    /// </span>
483    /// in HTML, (kCTWritingDirectionRightToLeft
484    /// | kCTWritingDirectionEmbedding) corresponding to a RLE/PDF
485    /// pair in plain text or a
486    /// <span dir="rtl">
487    /// </span>
488    /// in HTML,
489    /// (kCTWritingDirectionLeftToRight | kCTWritingDirectionOverride)
490    /// corresponding to a LRO/PDF pair in plain text or
491    /// <bdo
492    /// dir="ltr">
493    /// </bdo
494    /// > in HTML, and (kCTWritingDirectionRightToLeft
495    /// | kCTWritingDirectionOverride) corresponding to a RLO/PDF
496    /// pair in plain text or
497    /// <bdo
498    /// dir="rtl">
499    /// </bdo
500    /// > in HTML.
501    ///
502    ///
503    /// See also: kCTWritingDirectionLeftToRight
504    ///
505    /// See also: kCTWritingDirectionRightToLeft
506    ///
507    /// See also: kCTWritingDirectionEmbedding
508    ///
509    /// See also: kCTWritingDirectionOverride
510    ///
511    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctwritingdirectionattributename?language=objc)
512    pub static kCTWritingDirectionAttributeName: &'static CFString;
513}
514
515/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctwritingdirectionembedding?language=objc)
516pub const kCTWritingDirectionEmbedding: c_uint = 0 << 1;
517/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctwritingdirectionoverride?language=objc)
518pub const kCTWritingDirectionOverride: c_uint = 1 << 1;
519
520extern "C" {
521    /// Key to reference a CTRubyAnnotation.
522    ///
523    ///
524    /// Value must be a CTRubyAnnotationRef. See CTRubyAnnotation.h for
525    /// more information.
526    ///
527    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctrubyannotationattributename?language=objc)
528    pub static kCTRubyAnnotationAttributeName: &'static CFString;
529}
530
531extern "C" {
532    /// Provide the image for an emoji-like text attachment.
533    ///
534    ///
535    /// The attribute value must be an object conforming to the CTAdaptiveImageProviding protocol.
536    /// The range this attribute is applied to should be one or more U+FFFC characters, each of which will be drawn as the provided image,
537    /// and the font attribute applied to that range will be used to determine properties such as point size.
538    ///
539    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctadaptiveimageproviderattributename?language=objc)
540    pub static kCTAdaptiveImageProviderAttributeName: &'static CFString;
541}