<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreText",
  "identifier" : "/documentation/CoreText/CTRubyAnnotationCreateWithAttributes(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Text"
    ],
    "preciseIdentifier" : "c:@F@CTRubyAnnotationCreateWithAttributes"
  },
  "title" : "CTRubyAnnotationCreateWithAttributes(_:_:_:_:_:)"
}
-->

# CTRubyAnnotationCreateWithAttributes(_:_:_:_:_:)

Creates an immutable ruby annotation object with the specified attributes.

```
func CTRubyAnnotationCreateWithAttributes(_ alignment: CTRubyAlignment, _ overhang: CTRubyOverhang, _ position: CTRubyPosition, _ string: CFString, _ attributes: CFDictionary) -> CTRubyAnnotation
```

## Parameters

`alignment`

An alignment value that specifies how the ruby text and the base text align relative to each other.

`overhang`

An overhang value that specifies how the ruby text overhangs adjacent characters.

`position`

The position of the annotation text.

`string`

An unformatted string whose attributes derive from the `attributes` parameter.

`attributes`

An attribute dictionary to combine with `string`. If you don’t specify [`kCTFontAttributeName`](/documentation/CoreText/kCTFontAttributeName), the system deduces the ruby annotation’s font from the base text and uses a size factor of the <doc://com.apple.documentation/documentation/CoreFoundation/CFNumber> value keyed by [`kCTRubyAnnotationSizeFactorAttributeName`](/documentation/CoreText/kCTRubyAnnotationSizeFactorAttributeName).

## Return Value

A reference to a [`CTRubyAnnotation`](/documentation/CoreText/CTRubyAnnotation) object.

## Discussion

Use this function to create a ruby annotation object with more precise control of the annotation text.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)