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 pub static kCTCharacterShapeAttributeName: &'static CFString;
258}
259
260extern "C" {
261 /// Specifies text language.
262 ///
263 ///
264 /// Value must be a CFStringRef containing a locale identifier. Default
265 /// is unset. When this attribute is set to a valid identifier, it will
266 /// be used to select localized glyphs (if supported by the font) and
267 /// locale-specific line breaking rules.
268 ///
269 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctlanguageattributename?language=objc)
270 pub static kCTLanguageAttributeName: &'static CFString;
271}
272
273extern "C" {
274 /// Allows customization of certain aspects of a range of text's
275 /// appearance.
276 ///
277 ///
278 /// Value must be a CTRunDelegateRef. The values returned by the
279 /// embedded object for an attribute range apply to each glyph
280 /// resulting from the text in that range. Because an embedded object
281 /// is only a display-time modification, care should be taken to
282 /// avoid applying this attribute to a range of text with complex
283 /// behavior, such as a change of writing direction, combining marks,
284 /// etc. Consequently, it is recommended that this attribute be
285 /// applied to a range containing the single character U+FFFC. See
286 /// CTRunDelegate.h for more information.
287 ///
288 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctrundelegateattributename?language=objc)
289 pub static kCTRunDelegateAttributeName: &'static CFString;
290}
291
292/// Underline style specifiers.
293///
294///
295/// These underline type specifiers can be applied to the value set
296/// with the kCTUnderlineStyleAttributeName attribute to tell
297/// CoreText that you want a different underline style.
298///
299/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctunderlinestyle?language=objc)
300// NS_OPTIONS
301#[repr(transparent)]
302#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
303pub struct CTUnderlineStyle(pub i32);
304bitflags::bitflags! {
305 impl CTUnderlineStyle: i32 {
306 #[doc(alias = "kCTUnderlineStyleNone")]
307 const None = 0x00;
308 #[doc(alias = "kCTUnderlineStyleSingle")]
309 const Single = 0x01;
310 #[doc(alias = "kCTUnderlineStyleThick")]
311 const Thick = 0x02;
312 #[doc(alias = "kCTUnderlineStyleDouble")]
313 const Double = 0x09;
314 }
315}
316
317#[cfg(feature = "objc2")]
318unsafe impl Encode for CTUnderlineStyle {
319 const ENCODING: Encoding = i32::ENCODING;
320}
321
322#[cfg(feature = "objc2")]
323unsafe impl RefEncode for CTUnderlineStyle {
324 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
325}
326
327/// Underline style modifiers.
328///
329///
330/// Set these bits with the CTUnderlineStyle that you set with the
331/// kCTUnderlineStyleAttributeName attribute to modify how the
332/// underline will be drawn.
333///
334/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctunderlinestylemodifiers?language=objc)
335// NS_OPTIONS
336#[repr(transparent)]
337#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
338pub struct CTUnderlineStyleModifiers(pub i32);
339bitflags::bitflags! {
340 impl CTUnderlineStyleModifiers: i32 {
341 #[doc(alias = "kCTUnderlinePatternSolid")]
342 const PatternSolid = 0x0000;
343 #[doc(alias = "kCTUnderlinePatternDot")]
344 const PatternDot = 0x0100;
345 #[doc(alias = "kCTUnderlinePatternDash")]
346 const PatternDash = 0x0200;
347 #[doc(alias = "kCTUnderlinePatternDashDot")]
348 const PatternDashDot = 0x0300;
349 #[doc(alias = "kCTUnderlinePatternDashDotDot")]
350 const PatternDashDotDot = 0x0400;
351 }
352}
353
354#[cfg(feature = "objc2")]
355unsafe impl Encode for CTUnderlineStyleModifiers {
356 const ENCODING: Encoding = i32::ENCODING;
357}
358
359#[cfg(feature = "objc2")]
360unsafe impl RefEncode for CTUnderlineStyleModifiers {
361 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
362}
363
364extern "C" {
365 /// Key to reference a baseline class override.
366 ///
367 ///
368 /// Value must be one of the kCTBaselineClass constants. Normally,
369 /// glyphs on the line will be assigned baseline classes according to
370 /// the 'bsln' or 'BASE' table in the font. This attribute may be
371 /// used to change this assignment.
372 ///
373 ///
374 /// See also: kCTBaselineClassRoman
375 ///
376 /// See also: kCTBaselineClassIdeographicCentered
377 ///
378 /// See also: kCTBaselineClassIdeographicLow
379 ///
380 /// See also: kCTBaselineClassIdeographicHigh
381 ///
382 /// See also: kCTBaselineClassHanging
383 ///
384 /// See also: kCTBaselineClassMath
385 ///
386 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassattributename?language=objc)
387 pub static kCTBaselineClassAttributeName: &'static CFString;
388}
389
390extern "C" {
391 /// Key to reference a baseline info dictionary.
392 ///
393 ///
394 /// Value must be a CFDictionaryRef. Normally, baseline offsets will
395 /// be assigned based on the 'bsln' or 'BASE' table in the font. This
396 /// attribute may be used to assign different offsets. Each key in
397 /// the dictionary is one of the kCTBaselineClass constants and the
398 /// value is a CFNumberRef of the baseline offset in points. You only
399 /// need to specify the offsets you wish to change.
400 ///
401 ///
402 /// See also: kCTBaselineClassRoman
403 ///
404 /// See also: kCTBaselineClassIdeographicCentered
405 ///
406 /// See also: kCTBaselineClassIdeographicLow
407 ///
408 /// See also: kCTBaselineClassIdeographicHigh
409 ///
410 /// See also: kCTBaselineClassHanging
411 ///
412 /// See also: kCTBaselineClassMath
413 ///
414 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineinfoattributename?language=objc)
415 pub static kCTBaselineInfoAttributeName: &'static CFString;
416}
417
418extern "C" {
419 /// Key to reference a baseline info dictionary for the reference baseline.
420 ///
421 ///
422 /// Value must be a CFDictionaryRef. All glyphs in a run are assigned
423 /// a baseline class and then aligned to the offset for that class in
424 /// the reference baseline baseline info. See the discussion of
425 /// kCTBaselineInfoAttributeName for information about the contents
426 /// of the dictionary. You can also use the kCTBaselineReferenceFont
427 /// key to specify that the baseline offsets of a particular
428 /// CTFontRef should be used as the reference offsets.
429 ///
430 ///
431 /// See also: kCTBaselineClassRoman
432 ///
433 /// See also: kCTBaselineClassIdeographicCentered
434 ///
435 /// See also: kCTBaselineClassIdeographicLow
436 ///
437 /// See also: kCTBaselineClassIdeographicHigh
438 ///
439 /// See also: kCTBaselineClassHanging
440 ///
441 /// See also: kCTBaselineClassMath
442 ///
443 /// See also: kCTBaselineReferenceFont
444 ///
445 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselinereferenceinfoattributename?language=objc)
446 pub static kCTBaselineReferenceInfoAttributeName: &'static CFString;
447}
448
449extern "C" {
450 /// Controls vertical text positioning.
451 ///
452 ///
453 /// Value must be a CFNumberRef float. Default is standard positioning.
454 /// The baseline attribute indicates how many points the characters
455 /// should be shifted perpendicular to their baseline. A positive
456 /// baseline value indicates a shift above (or to the right for vertical
457 /// text) the text baseline and a negative baseline value indicates a
458 /// shift below (or to the left for vertical text) the text baseline.
459 /// If this value is set to 0.0, no baseline shift will be performed.
460 ///
461 ///
462 /// See also: NSBaselineOffsetAttributeName
463 ///
464 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineoffsetattributename?language=objc)
465 pub static kCTBaselineOffsetAttributeName: &'static CFString;
466}
467
468extern "C" {
469 /// Specifies a bidirectional override or embedding.
470 ///
471 ///
472 /// Value must be a CFArray of CFNumberRefs, each of which should
473 /// have a value of either kCTWritingDirectionLeftToRight or
474 /// kCTWritingDirectionRightToLeft, plus one of
475 /// kCTWritingDirectionEmbedding or kCTWritingDirectionOverride.
476 /// This array represents a sequence of nested bidirectional
477 /// embeddings or overrides, in order from outermost to innermost,
478 /// with (kCTWritingDirectionLeftToRight | kCTWritingDirectionEmbedding)
479 /// corresponding to a LRE/PDF pair in plain text or
480 /// <span dir="ltr">
481 /// </span>
482 /// in HTML, (kCTWritingDirectionRightToLeft
483 /// | kCTWritingDirectionEmbedding) corresponding to a RLE/PDF
484 /// pair in plain text or a
485 /// <span dir="rtl">
486 /// </span>
487 /// in HTML,
488 /// (kCTWritingDirectionLeftToRight | kCTWritingDirectionOverride)
489 /// corresponding to a LRO/PDF pair in plain text or
490 /// <bdo
491 /// dir="ltr">
492 /// </bdo
493 /// > in HTML, and (kCTWritingDirectionRightToLeft
494 /// | kCTWritingDirectionOverride) corresponding to a RLO/PDF
495 /// pair in plain text or
496 /// <bdo
497 /// dir="rtl">
498 /// </bdo
499 /// > in HTML.
500 ///
501 ///
502 /// See also: kCTWritingDirectionLeftToRight
503 ///
504 /// See also: kCTWritingDirectionRightToLeft
505 ///
506 /// See also: kCTWritingDirectionEmbedding
507 ///
508 /// See also: kCTWritingDirectionOverride
509 ///
510 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctwritingdirectionattributename?language=objc)
511 pub static kCTWritingDirectionAttributeName: &'static CFString;
512}
513
514/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctwritingdirectionembedding?language=objc)
515pub const kCTWritingDirectionEmbedding: c_uint = 0 << 1;
516/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctwritingdirectionoverride?language=objc)
517pub const kCTWritingDirectionOverride: c_uint = 1 << 1;
518
519extern "C" {
520 /// Key to reference a CTRubyAnnotation.
521 ///
522 ///
523 /// Value must be a CTRubyAnnotationRef. See CTRubyAnnotation.h for
524 /// more information.
525 ///
526 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctrubyannotationattributename?language=objc)
527 pub static kCTRubyAnnotationAttributeName: &'static CFString;
528}
529
530extern "C" {
531 /// Provide the image for an emoji-like text attachment.
532 ///
533 ///
534 /// The attribute value must be an object conforming to the CTAdaptiveImageProviding protocol.
535 /// 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,
536 /// and the font attribute applied to that range will be used to determine properties such as point size.
537 ///
538 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctadaptiveimageproviderattributename?language=objc)
539 pub static kCTAdaptiveImageProviderAttributeName: &'static CFString;
540}