DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | Class Methods | List of all members
DKTextShape Class Reference

Text shapes are shapes that draw text. More...

Inheritance diagram for DKTextShape:
Inheritance graph
[legend]

Instance Methods

(IBAction) - alignCenter:
 
(IBAction) - alignJustified:
 
(IBAction) - alignLeft:
 
(NSTextAlignment) - alignment
 
(IBAction) - alignRight:
 
(BOOL- canPasteText:
 Test whether the pasteboard contains any text we can paste. More...
 
(IBAction) - capitalize:
 
(IBAction) - changeAttributes:
 
(IBAction) - changeFont:
 
(IBAction) - changeFontSize:
 
(IBAction) - changeLayoutMode:
 
(IBAction) - convertToShape:
 
(IBAction) - convertToShapeGroup:
 
(IBAction) - convertToTextPath:
 
(IBAction) - editText:
 
(void) - endEditing
 
(IBAction) - fitToText:
 
(NSFont *) - font
 Gets the text's font. More...
 
(CGFloat- fontSize
 Gets the text's font size. More...
 
(NSSize) - idealTextSize
 Return the ideal size of the text layout area. More...
 
(BOOL- isEditing
 
(DKTextLayoutMode) - layoutMode
 
(IBAction) - loosenKerning:
 
(IBAction) - lowerBaseline:
 
(DKShapeGroup *) - makeShapeGroupWithText
 High level method turns the text into a drawable shape group having each glyph as a subobject. More...
 
(DKDrawableShape *) - makeShapeWithText
 High level method turns the text into a drawable shape having the text as its path. More...
 
(NSSize) - maxSize
 Return the maximum size of the text layout area. More...
 
(NSSize) - minSize
 Return the minimum size of the text layout area. More...
 
(NSParagraphStyle *) - paragraphStyle
 
(IBAction) - paste:
 
(void) - pasteTextFromPasteboard:ignoreFormatting:
 Set the object's text from the pasteboard, optionally ignoring its formatting. More...
 
(IBAction) - raiseBaseline:
 
(void) - scaleTextBy:
 
(void) - setAlignment:
 
(void) - setFont:
 Sets the text's font, if permitted. More...
 
(void) - setFontSize:
 Sets the text's font size, if permitted. More...
 
(void) - setLayoutMode:
 
(void) - setParagraphStyle:
 
(void) - setText:
 
(void) - setTextAdornment:
 
(void) - setTextColour:
 
(void) - setVerticalAlignment:
 
(void) - setVerticalAlignmentProportion:
 
(void) - setWrapsLines:
 
(void) - sizeVerticallyToFitText
 Adjust the object's height to match the height of the current text. More...
 
(void) - startEditingInView:
 
(NSString *) - string
 Get the string of the text shape. More...
 
(DKStyle *) - styleWithTextAttributes
 Creates a style that attempts to maintain fidelity of appearance based on the text's attributes. More...
 
(IBAction) - subscript:
 
(IBAction) - superscript:
 
(DKStyle *) - syntheticStyle
 Creates a style that is the current style + any text attributes. More...
 
(IBAction) - takeTextAlignmentFromSender:
 
(IBAction) - takeTextVerticalAlignmentFromSender:
 
(NSTextStorage *) - text
 Get the text of the text shape. More...
 
(DKTextAdornment *) - textAdornment
 
(NSDictionary *) - textAttributes
 
(NSColor *) - textColour
 
(NSBezierPath *) - textPath
 Return the current text as a path. More...
 
(NSArray *) - textPathGlyphs
 Return the individual glyph paths in an array. More...
 
(NSArray *) - textPathGlyphsUsedSize:
 Return the individual glyph paths in an array and the size used. More...
 
(IBAction) - tightenKerning:
 
(IBAction) - turnOffKerning:
 
(IBAction) - underline:
 
(IBAction) - unscript:
 
(void) - updateFontPanel
 
(IBAction) - useStandardKerning:
 
(IBAction) - verticalAlign:
 
(DKVerticalTextAlignment) - verticalAlignment
 
(CGFloat- verticalAlignmentProportion
 
(BOOL- wrapsLines
 
- Instance Methods inherited from DKDrawableShape
(NSInteger- addHotspot:
 
(void) - adjustToFitGrid:
 
(void) - adoptPath:
 
(BOOL- allowSizeKnobsToRotateShape
 
(NSArray *) - breakApart
 
(BOOL- canPastePathWithPasteboard:
 
(NSPoint) - convertPointFromRelativeLocation:
 
(IBAction) - convertToPath:
 
(DKDistortionTransform *) - distortionTransform
 
(void) - drawHotspotAtPoint:inState:
 
(void) - drawHotspotsInState:
 
(void) - drawKnob:
 
(void) - flipHorizontally
 
(void) - flipVertically
 
(DKHotspot *) - hotspotForPartCode:
 
(NSPoint) - hotspotPointForPartcode:
 
(NSRect- hotspotRect:
 
(NSArray *) - hotspots
 
(DKHotspot *) - hotspotUnderMouse:
 
(id- initWithBezierPath:
 
(id- initWithBezierPath:rotatedToAngle:
 
(id- initWithBezierPath:rotatedToAngle:style:
 
(id- initWithBezierPath:style:
 
(id- initWithCanonicalBezierPath:
 
(id- initWithCanonicalBezierPath:style:
 
(id- initWithOvalInRect:
 
(id- initWithOvalInRect:style:
 
(id- initWithRect:
 
(id- initWithRect:style:
 
(NSAffineTransform *) - inverseTransform
 
(NSPoint) - knobPoint:
 
(NSPoint) - locationIgnoringOffset
 
(DKDrawablePath *) - makePath
 
(void) - moveKnob:toPoint:allowRotate:constrain:
 
(NSInteger- operationMode
 
(IBAction) - pastePath:
 
(NSBezierPath *) - path
 
(NSBezierPath *) - path:withFinalSize:offsetBy:fromPartcode:
 Transforms a path to the final size and position relative to a partcode. More...
 
(NSBezierPath *) - pathWithFinalSize:offsetBy:fromPartcode:
 Return a rectangular path offset from a given partcode. More...
 
(NSBezierPath *) - pathWithRelativePosition:finalSize:
 Return a rectangular path with given relative origin but absolute final size. More...
 
(NSBezierPath *) - pathWithRelativeRect:
 Return a rectangular path with given size and origin. More...
 
(NSPoint) - pointForRelativeLocation:
 Convert a point from relative coordinates to absolute coordinates. More...
 
(void) - removeHotspot:
 
(void) - resetBoundingBox
 
(IBAction) - resetBoundingBox:
 
(void) - resetBoundingBoxAndRotation
 
(void) - reshapePath
 
(IBAction) - rotate:
 
(void) - rotateUsingReferencePoint:constrain:
 
(NSPoint) - rotationKnobPoint
 
(void) - setDistortionTransform:
 
(IBAction) - setDistortMode:
 
(void) - setDragAnchorToPart:
 
(void) - setHotspots:
 
(void) - setOperationMode:
 
(void) - setPath:
 
(IBAction) - toggleHorizontalFlip:
 
(IBAction) - toggleVerticalFlip:
 
(NSAffineTransform *) - transform
 Return a transform that maps the object's stored path to its true location in the drawing. More...
 
(NSBezierPath *) - transformedPath
 
(NSAffineTransform *) - transformIncludingParent
 
(NSString *) - undoActionNameForPartCode:
 
(IBAction) - unrotate:
 
- Instance Methods inherited from DKDrawableObject
(void) - addMetadata:
 
(void) - addUserInfo:
 
(NSSet *) - allRegisteredStyles
 
(NSSet *) - allStyles
 
(CGFloat- angle
 
(CGFloat- angleInDegrees
 Return the shape's current rotation angle. More...
 
(NSRect- apparentBounds
 
(void) - applyTransform:
 Apply the transform to the object. More...
 
(NSRect- bounds
 
(NSImage *) - cachedImage
 Returns an image of the object representing its current appearance at 100% scale. More...
 
(NSColor *) - colourForKey:
 
(id< DKDrawableContainer >) - container
 Returns the immediate parent of this object. More...
 
(NSAffineTransform *) - containerTransform
 Return the container's transform. More...
 
(CGFloat- convertLength:
 
(NSPoint) - convertPointToDrawing:
 
(IBAction) - copyDrawingStyle:
 
(void) - creationTool:willBeginCreationAtPoint:
 
(void) - creationTool:willEndCreationAtPoint:
 
(NSView *) - currentView
 
(NSCursor *) - cursorForPartcode:mouseButtonDown:
 
(void) - detachStyle
 If the object's style is currently sharable, copy it and make it non-sharable. More...
 
(void) - drawContent
 
(void) - drawContentInRect:fromRect:withStyle:
 
(void) - drawContentWithSelectedState:
 
(void) - drawContentWithStyle:
 
(void) - drawGhostedContent
 
(DKDrawing *) - drawing
 
(void) - drawSelectedState
 
(void) - drawSelectionPath:
 
(NSSize) - extraSpaceNeeded
 
(CGFloat- floatValueForKey:
 
(NSUInteger- geometryChecksum
 
(void) - group:willUngroupObjectWithTransform:
 This object is being ungrouped from a group. More...
 
(void) - groupWillAddObject:
 This object is being added to a group. More...
 
(BOOL- hasMetadataForKey:
 
(NSInteger- hitPart:
 
(NSInteger- hitSelectedPart:forSnapDetection:
 
(NSUInteger- indexInContainer
 Returns the index position of this object in its container layer. More...
 
(id- initWithStyle:
 Initializes the drawable to have the style given. More...
 
(BOOL- intersectsRect:
 
(NSInteger- intValueForKey:
 
(void) - invalidateRenderingCache
 Discard all cached rendering information. More...
 
(BOOL- isBeingHitTested
 Is a hit-test in progress. More...
 
(BOOL- isGhosted
 Retuirn whether the object is ghosted rather than with its full style. More...
 
(BOOL- isKeyObject
 Is the object currently the layer's key object? More...
 
(BOOL- isPendingObject
 Is the object currently a pending object? More...
 
(BOOL- isSelected
 
(BOOL- isTrackingMouse
 
(DKKnobType) - knobTypeForPartCode:
 
(DKObjectOwnerLayer *) - layer
 Returns the layer that this object ultimately belongs to. More...
 
(NSPoint) - location
 
(BOOL- locationLocked
 Whether the object's location is locked or not. More...
 
(IBAction) - lock:
 
(BOOL- locked
 
(IBAction) - lockLocation:
 
(NSRect- logicalBounds
 
(NSMenu *) - menu
 Reurn the menu to use as the object's contextual menu. More...
 
(NSMutableDictionary *) - metadata
 
(NSUInteger- metadataChecksum
 
(void) - metadataDidChangeKey:
 
(DKMetadataItem *) - metadataItemForKey:
 
(DKMetadataItem *) - metadataItemForKey:limitToLocalSearch:
 
(NSArray *) - metadataItemsForKeysInArray:
 
(NSArray *) - metadataItemsForKeysInArray:limitToLocalSearch:
 
(NSArray *) - metadataKeys
 
(id- metadataObjectForKey:
 
(void) - metadataWillChangeKey:
 
(void) - mouseDoubleClickedAtPoint:inPart:event:
 
(void) - mouseDownAtPoint:inPart:event:
 
(void) - mouseDraggedAtPoint:inPart:event:
 
(NSSize) - mouseDragOffset
 
(BOOL- mouseHasMovedSinceStartOfTracking
 
(NSSize) - mouseOffset
 
(BOOL- mouseSnappingEnabled
 
(void) - mouseUpAtPoint:inPart:event:
 
(void) - notifyGeometryChange:
 
(void) - notifyStatusChange
 
(void) - notifyVisualChange
 
(void) - objectDidBecomeSelected
 
(void) - objectIsNoLongerSelected
 
(BOOL- objectIsValid
 
(BOOL- objectMayBecomeSelected
 Is the object able to be selected? More...
 
(void) - objectWasAddedToLayer:
 The object was added to a layer. More...
 
(void) - objectWasRemovedFromLayer:
 The object was removed from the layer. More...
 
(void) - objectWasUngrouped
 This object was ungrouped from a group. More...
 
(NSSize) - offset
 
(void) - offsetLocationByX:byY:
 
(NSAttributedString *) - originalText
 
(IBAction) - pasteDrawingStyle:
 
(NSData *) - pdf
 Returns the single object rendered as a PDF image. More...
 
(NSPoint) - pointForPartcode:
 
(BOOL- pointHitsPath:
 Test a point against the offscreen bitmap representation of the shape. More...
 
(BOOL- populateContextualMenu:
 
(BOOL- populateContextualMenu:atPoint:
 
(void) - readSupplementaryDataFromPasteboard:
 Read additional data from the pasteboard specific to the object. More...
 
(BOOL- rectHitsPath:
 Test if a rect encloses any of the shape's actual pixels. More...
 
(void) - removeMetadataForKey:
 
(NSBezierPath *) - renderingPath
 
(void) - replaceMatchingStylesFromSet:
 
(void) - resetOffset
 
(void) - resizeWidthBy:heightBy:
 
(void) - rotateByAngle:
 Rotate the shape by adding a delta angle to the current angle. More...
 
(DKMetadataSchema) - schema
 
(void) - setAngle:
 Set the object's current angle in radians. More...
 
(void) - setBeingHitTested:
 Set whether a hit-test in progress. More...
 
(void) - setColour:forKey:
 
(void) - setContainer:
 
(void) - setFloatValue:forKey:
 
(void) - setGhosted:
 Set whether the object is ghosted rather than with its full style. More...
 
(void) - setIntValue:forKey:
 
(void) - setLocation:
 
(void) - setLocationLocked:
 Sets whether the object's location is locked or not. More...
 
(void) - setLocked:
 
(void) - setMetadata:
 
(void) - setMetadataItem:forKey:
 
(void) - setMetadataItemType:forKey:
 
(void) - setMetadataItemValue:forKey:
 
(void) - setMetadataObject:forKey:
 
(void) - setMouseDragOffset:
 
(void) - setMouseHasMovedSinceStartOfTracking:
 
(void) - setMouseSnappingEnabled:
 
(void) - setNeedsDisplayInRect:
 
(void) - setNeedsDisplayInRects:
 
(void) - setNeedsDisplayInRects:withExtraPadding:
 
(void) - setOffset:
 
(void) - setOriginalText:
 
(void) - setSize:
 
(void) - setSize:forKey:
 
(void) - setString:forKey:
 
(void) - setStyle:
 
(void) - setTrackingMouse:
 
(void) - setupMetadata
 
(void) - setUserInfo:
 
(void) - setUserInfoObject:forKey:
 Set an item of user info. More...
 
(void) - setVisible:
 
(NSSize) - size
 
(NSSize) - sizeForKey:
 
(NSPoint) - snappedMousePoint:forSnappingPointsWithControlFlag:
 
(NSPoint) - snappedMousePoint:withControlFlag:
 Offset the point to cause snap to grid + guides accoding to the drawing's settings. More...
 
(NSArray *) - snappingPoints
 
(NSArray *) - snappingPointsWithOffset:
 
(NSString *) - stringForKey:
 
(DKStyle *) - style
 
(void) - styleDidChange:
 
(void) - styleWillChange:
 
(NSSet *) - subSelection
 Return the subselection of the object. More...
 
(NSImage *) - swatchImageWithSize:
 
(NSUndoManager *) - undoManager
 
(IBAction) - unlock:
 
(IBAction) - unlockLocation:
 
(void) - updateMetadataKeys
 
(void) - updateRulerMarkers
 
(BOOL- useLowQualityDrawing
 
(NSMutableDictionary *) - userInfo
 Return the attached user info. More...
 
(id- userInfoObjectForKey:
 Return an item of user info. More...
 
(BOOL- visible
 
(void) - willBeAddedAsSubstituteFor:toLayer:
 Some high-level operations substitute a new object in place of an existing one (or several). More...
 
(void) - writeSupplementaryDataToPasteboard:
 Write additional data to the pasteboard specific to the object. More...
 
- Instance Methods inherited from NSObject
(NSString *) - address
 
(DKStyleRegistry *) - applicationWillReturnStyleRegistry
 
(BOOL- canBeUsedWithSelectionTool
 
(id- categoryManager:shouldReplaceObject:withObject:
 
(Class- classForCoder
 
(NSColor *) - colorValue
 
(NSColor *) - colourValue
 
(id- copy
 
(void) - dealloc
 
(id- deepCopy
 
(NSDictionary *) - dimensionValuesForArrowStroke:
 
(CGFloat- drawing:convertDistanceToExternalCoordinates:
 
(NSPoint) - drawing:convertLocationToExternalCoordinates:
 
(void) - drawing:didDrawRect:inView:
 
(void) - drawing:willDrawRect:inView:
 
(NSString *) - drawing:willReturnAbbreviationForUnit:
 
(NSString *) - drawing:willReturnFormattedCoordinateForDistance:
 
(CGFloat- drawingWillReturnUnitToPointsConversonFactor:
 
(void) - finalize
 
(NSString *) - hexString
 
(void) - hotspot:didEndTrackingWithEvent:inView:
 
(void) - hotspot:isTrackingWithEvent:inView:
 
(void) - hotspot:willBeginTrackingWithEvent:inView:
 
(NSData *) - imageData
 
(NSImage *) - imageResourceNamed:
 
(id- init
 
(id- initWithExpression:
 
(id- instantiateObjectWithShortName:parameters:
 
(BOOL- isLiteralValue
 
(void) - layoutManager:willPlaceGlyphAtIndex:atLocation:pathAngle:yOffset:
 
(void) - menuItem:wasAddedForObject:inCategory:
 
(BOOL- moveObjectTo:position:slope:userInfo:
 
(id- mutableCopy
 
(void) - oneShotComplete
 
(void) - oneShotHasReached:
 
(void) - oneShotWillBegin
 
(void) - path:elementIndex:type:points:subPathIndex:subPathClosed:contextInfo:
 
(id- placeLinkFromPoint:toPoint:onPath:linkNumber:userInfo:
 
(id- placeObjectAtPoint:onPath:position:slope:userInfo:
 
(NSPoint) - point
 
(NSPoint) - pointForTextLayout
 
(DKStyle *) - registry:shouldReplaceStyle:withStyle:
 
(NSBezierPath *) - renderer:willRenderPath:
 
(void) - routeFinder:progressHasReached:
 
(void) - setValue:forNumericParameter:
 
(NSString *) - stringValue
 
(CGFloat- taperFactorAtDistance:onPath:ofLength:
 
(void) - toolDidPerformUndoableAction:
 
(void) - toolWillPerformUndoableAction:
 
(NSURL *) - url
 
- Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 
- Instance Methods inherited from <NSKeyValueBindingCreation>
(void) - bind:toObject:withKeyPath:options:
 
(NSArray *) - exposedBindings
 
(NSDictionary *) - infoForBinding:
 
(NSArray *) - optionDescriptionsForBinding:
 
(void) - unbind:
 
(Class- valueClassForBinding:
 
- Instance Methods inherited from <DKStorableObject>
(NSUInteger- index
 
(BOOL- isMarked
 
(void) - setIndex:
 
(void) - setMarked:
 
(void) - setStorage:
 
(id< DKObjectStorage >) - storage
 
- Instance Methods inherited from <NSCoding>
(void) - encodeWithCoder:
 
(id- initWithCoder:
 
- Instance Methods inherited from <NSCopying>
(id- copyWithZone:
 
- Instance Methods inherited from <DKRenderable>
(NSMutableDictionary *) - renderingCache
 

Class Methods

(BOOL+ allowsInlineImages
 Whether text editing permits inline images to be pasted. More...
 
(NSString *) + defaultTextString
 Get the initial text string for new text shape objects. More...
 
(NSArray *) + pastableTextTypes
 Return a list of types we can paste in priority order. More...
 
(void) + setAllowsInlineImages:
 Set whether text editing permits inline images to be pasted. More...
 
(void) + setDefaultTextString:
 Set the initial text string for new text shape objects. More...
 
(void) + setShowsTextOverflowIndicator:
 Set whether objects of this class should display an overflow symbol when text can't be fully laid. More...
 
(BOOL+ showsTextOverflowIndicator
 Return whether objects of this class should display an overflow symbol when text can't be fully laid. More...
 
(Class+ textAdornmentClass
 Return the class of object to create as the shape's text adornment. More...
 
(NSBezierPath *) + textOverflowIndicatorPath
 Return a path used for indicating unlaid text in object. More...
 
(DKTextShape *) + textShapeWithAttributedString:
 Create an instance of a DKTextShape with the given string, laid out on one line. More...
 
(DKTextShape *) + textShapeWithRTFData:inRect:
 Create an instance of a DKTextShape with the RTF data and rect. More...
 
(DKTextShape *) + textShapeWithString:inRect:
 Create an instance of a DKTextShape with the initial string and rect. More...
 
- Class Methods inherited from DKDrawableShape
(NSCursor *) + cursorForShapePartcode:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:rotatedToAngle:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:rotatedToAngle:withStyle:
 
(DKDrawableShape *) + drawableShapeWithBezierPath:withStyle:
 
(DKDrawableShape *) + drawableShapeWithCanonicalBezierPath:
 
(DKDrawableShape *) + drawableShapeWithOvalInRect:
 
(DKDrawableShape *) + drawableShapeWithRect:
 
(NSInteger+ knobMask
 Return which particular knobs are used by instances of this class. More...
 
(void) + setAngularConstraintAngle:
 
(void) + setInfoWindowBackgroundColour:
 
(void) + setKnobMask:
 
(NSRect+ unitRectAtOrigin
 
- Class Methods inherited from DKDrawableObject
(Class+ classForConversionRequestFor:
 Return the class to use in place of the given class when performing a conversion. More...
 
(NSUInteger+ countOfNativeObjectsOnPasteboard:
 Return the number of native objects held by the pasteboard. More...
 
(BOOL+ displaysSizeInfoWhenDragging
 Return whether an info floater is displayed when resizing an object. More...
 
(NSColor *) + ghostColour
 Return the outline colour to use when drawing objects in their ghosted state. More...
 
(NSInteger+ initialPartcodeForObjectCreation
 
(NSDictionary *) + interconversionTable
 Return the interconversion table. More...
 
(BOOL+ isGroupable
 Return whether obejcts of this class can be grouped. More...
 
(BOOL+ metadataChangesAreUndoable
 
(NSArray *) + nativeObjectsFromPasteboard:
 
(NSArray *) + pasteboardTypesForOperation:
 
(void) + setDisplaysSizeInfoWhenDragging:
 Set whether an info floater is displayed when resizing an object. More...
 
(void) + setGhostColour:
 Set the outline colour to use when drawing objects in their ghosted state. More...
 
(void) + setInterconversionTable:
 Return the interconversion table. More...
 
(void) + setMetadataChangesAreUndoable:
 
(void) + substituteClass:forClass:
 Sets the class to use in place of the a base class when performing a conversion. More...
 
(NSRect+ unionOfBoundsOfDrawablesInArray:
 Returns the union of the bounds of the objects in the array. More...
 
- Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 

Additional Inherited Members

- Protected Attributes inherited from DKDrawableShape
BOOL m_inRotateOp
 
NSRect mBoundsCache
 
- Protected Attributes inherited from DKDrawableObject
BOOL m_clipToBBox: 1
 
BOOL m_showBBox: 1
 
BOOL m_showPartcodes: 1
 
BOOL m_showTargets: 1
 
BOOL m_unused_padding: 4
 

Detailed Description

Text shapes are shapes that draw text.

Text shapes are shapes that draw text.

For b5 and later this object has been redesigned to harmonise text handling to common classes within the framework. This has numerous advantages such as fewer bugs and more flexibility. Now, a text shape has a DKTextAdornment property that is independent of its style. This T/A handles the text storage, layout and rendering of the text just as it does when contained by a style. This T/A is drawn after (on top of) all other style renderings.

Because the T/A is independent of the style, it may be directly changed by text attibute operations such as font changes without concern for whether the style is locked or not. Unless th eobject itself is locked therefore, text attributs are always changeable. When a style is set and it has text attributes, those attributes are initially applied to the T/A but from then on take no further part. Thus the need to synchronise styles and local attributes disappears.

The use of a T/A opens up more options for text layout such as flowed into the path, along the path as well as block text.

Some methods no longer have meaning in the redesigned class and have been deprecated. Calling them is now a no-op. Reading in an old-style version of the class will be translated to the new approach. Some functionality has been moved to the DKTextAdornment class.

Method Documentation

- (IBAction) alignCenter: (id sender
- (IBAction) alignJustified: (id sender
- (IBAction) alignLeft: (id sender
- (NSTextAlignment) alignment
- (IBAction) alignRight: (id sender
+ (BOOL) allowsInlineImages

Whether text editing permits inline images to be pasted.

This state is persistent and ends up as the parameter to [NSTextView setImportsGraphics:]

Returns
YES to allow images, NO to disallow
- (BOOL) canPasteText: (NSPasteboard *)  pb

Test whether the pasteboard contains any text we can paste.

Parameters
pba pasteboard
Returns
YES if there is text of any kind that we can paste, NO otherwise
- (IBAction) capitalize: (id sender
- (IBAction) changeAttributes: (id sender
- (IBAction) changeFont: (id sender
- (IBAction) changeFontSize: (id sender
- (IBAction) changeLayoutMode: (id sender
- (IBAction) convertToShape: (id sender
- (IBAction) convertToShapeGroup: (id sender
- (IBAction) convertToTextPath: (id sender
+ (NSString*) defaultTextString

Get the initial text string for new text shape objects.

The default is usually "Double-click to edit this text"

Returns
a string
- (IBAction) editText: (id sender
- (void) endEditing
- (IBAction) fitToText: (id sender
- (NSFont*) font

Gets the text's font.

Returns
the current font
- (CGFloat) fontSize

Gets the text's font size.

Returns
the size of the text's current font
- (NSSize) idealTextSize

Return the ideal size of the text layout area.

Returns the size needed to accommodate the text, honouring min and max and whether the shape has already had its size set

Returns
a size, the ideal text size
- (BOOL) isEditing
- (DKTextLayoutMode) layoutMode
- (IBAction) loosenKerning: (id sender
- (IBAction) lowerBaseline: (id sender
- (DKShapeGroup*) makeShapeGroupWithText

High level method turns the text into a drawable shape group having each glyph as a subobject.

Creates a group object containing individual path objects each with one letter of the text, but overall retaining the same spatial relationships as the original text in the shape. This allows you to convert text to a graphic in a way that allows you to get at each individual letter, as opposed to converting to a path and then breaking it apart, which goes too far in that subcurves within letters become separated. May fail (returning nil) if there are fewer than 2 valid paths submitted to make a group.

Returns
a new shape group object.
- (DKDrawableShape*) makeShapeWithText

High level method turns the text into a drawable shape having the text as its path.

This tries to maintain as much fidelity as it can in terms of the text's appearance - attributes such as the colour and shadow are used to construct a style for the new object.

Returns
a new shape object.
- (NSSize) maxSize

Return the maximum size of the text layout area.

Subclasses can specify something else

Returns
a size, the largest width and height of the text
- (NSSize) minSize

Return the minimum size of the text layout area.

Subclasses can specify something else

Returns
a size, the smallest width and height text can be laid out in
- (NSParagraphStyle*) paragraphStyle
+ (NSArray*) pastableTextTypes

Return a list of types we can paste in priority order.

Cocoa's -textPasteboardTypes isn't in an order that is useful to us

Returns
a list of types
- (IBAction) paste: (id sender
- (void) pasteTextFromPasteboard: (NSPasteboard *)  pb
ignoreFormatting: (BOOL fmt 

Set the object's text from the pasteboard, optionally ignoring its formatting.

If the style is locked, even if fmt is NO it won't be updated.

Parameters
pba pasteboard
fmtYES to just paste the string and use the existing attributes, NO to update with the pasted
- (IBAction) raiseBaseline: (id sender
- (void) scaleTextBy: (CGFloat factor
- (void) setAlignment: (NSTextAlignment)  align
+ (void) setAllowsInlineImages: (BOOL allowed

Set whether text editing permits inline images to be pasted.

This state is persistent and ends up as the parameter to [NSTextView setImportsGraphics:]

Parameters
allowedYES to allow images, NO to disallow
+ (void) setDefaultTextString: (NSString *)  str

Set the initial text string for new text shape objects.

The default is usually "Double-click to edit this text"

Parameters
stra string
- (void) setFont: (NSFont *)  font

Sets the text's font, if permitted.

Updates the style if using it and it's not locked

Parameters
fonta new font
- (void) setFontSize: (CGFloat size

Sets the text's font size, if permitted.

Updates the style if using it and it's not locked. Currently does nothing if using local attributes - use setFont: instead.

Parameters
sizethe point size of the font
- (void) setLayoutMode: (DKTextLayoutMode)  mode
- (void) setParagraphStyle: (NSParagraphStyle *)  ps
+ (void) setShowsTextOverflowIndicator: (BOOL overflowShown

Set whether objects of this class should display an overflow symbol when text can't be fully laid.

Setting is persistent

Parameters
overflowShownYES to dislay, NO otherwise
- (void) setText: (id contents
- (void) setTextAdornment: (DKTextAdornment *)  adornment
- (void) setTextColour: (NSColor *)  colour
- (void) setVerticalAlignment: (DKVerticalTextAlignment)  align
- (void) setVerticalAlignmentProportion: (CGFloat prop
- (void) setWrapsLines: (BOOL wraps
+ (BOOL) showsTextOverflowIndicator

Return whether objects of this class should display an overflow symbol when text can't be fully laid.

See also: -drawSelectedState

Returns
YES to dislay, NO otherwise
- (void) sizeVerticallyToFitText

Adjust the object's height to match the height of the current text.

Honours the minimum and maximum sizes set

- (void) startEditingInView: (DKDrawingView *)  view
- (NSString*) string

Get the string of the text shape.

This returns just the characters - no attributes

Returns
the object's text string
- (DKStyle*) styleWithTextAttributes

Creates a style that attempts to maintain fidelity of appearance based on the text's attributes.

Returns
a new style object.
- (IBAction) subscript: (id sender
- (IBAction) superscript: (id sender
- (DKStyle*) syntheticStyle

Creates a style that is the current style + any text attributes.

A style which is the current style if it has text attributes, otherwise the current style with added text attributes. When cutting or copying the object's style, this is what should be used.

Returns
a new style object
- (IBAction) takeTextAlignmentFromSender: (id sender
- (IBAction) takeTextVerticalAlignmentFromSender: (id sender
- (NSTextStorage*) text

Get the text of the text shape.

The returned text has attributes applied wherever they come from - the style or local.

Returns
the object's text
- (DKTextAdornment*) textAdornment
+ (Class) textAdornmentClass

Return the class of object to create as the shape's text adornment.

This provides an opportunity for subclasses to supply a different type of object, which must be a DKTextAdornment, a subclass of it, or one that implements its API.

Returns
the object class
- (NSDictionary*) textAttributes
- (NSColor*) textColour
+ (NSBezierPath*) textOverflowIndicatorPath

Return a path used for indicating unlaid text in object.

The path consists of a plus sign within a square with origin at 0,0 and sides 1,1

Returns
a path
- (NSBezierPath*) textPath

Return the current text as a path.

Returns
the path contains the glyphs laid out exactly as the object displays them, with the same line breaks, etc. The path is transformed to the object's current location and angle.
- (NSArray*) textPathGlyphs

Return the individual glyph paths in an array.

Returns
an array containing all of the individual glyph paths (i.e. each item in the array is one letter).
- (NSArray*) textPathGlyphsUsedSize: (NSSize *)  textSize

Return the individual glyph paths in an array and the size used.

Parameters
textSizereceives the resulting sixe occupied by the text
Returns
an array containing all of the individual glyph paths (i.e. each item in the array is one letter).
+ (DKTextShape*) textShapeWithAttributedString: (NSAttributedString *)  str

Create an instance of a DKTextShape with the given string, laid out on one line.

The object is sized to fit the text string passed on a single line (up to a certain sensible maximum width). The returned object needs to be positioned where it is needed.

Parameters
strthe string
Returns
an autoreleased DKTextShape instance
+ (DKTextShape*) textShapeWithRTFData: (NSData *)  rtfData
inRect: (NSRect bounds 

Create an instance of a DKTextShape with the RTF data and rect.

Parameters
rtfDataNSData representing some RTF text
boundsthe bounding rectangle of the shape
Returns
an autoreleased DKTextShape instance
+ (DKTextShape*) textShapeWithString: (NSString *)  str
inRect: (NSRect bounds 

Create an instance of a DKTextShape with the initial string and rect.

Parameters
strthe initial string to set
boundsthe bounding rectangle of the shape
Returns
an autoreleased DKTextShape instance
- (IBAction) tightenKerning: (id sender
- (IBAction) turnOffKerning: (id sender
- (IBAction) underline: (id sender
- (IBAction) unscript: (id ssender
- (void) updateFontPanel
- (IBAction) useStandardKerning: (id sender
- (IBAction) verticalAlign: (id sender
- (DKVerticalTextAlignment) verticalAlignment
- (CGFloat) verticalAlignmentProportion
- (BOOL) wrapsLines