FAQ Database Discussion Community


Karaoke-like progress highlight for iOS

ios,cocoa-touch,core-graphics,core-animation,core-text
I would like to implement karaoke-like progress highlight for iOS. I know I could use NSAttributedString and highlight the text character by character. However, I would like the highlight to progress pixel by pixel, not character by character. Any ideas? P.S. No need for sample code, just point me to...

core text displayed text is drawn without spacing

osx,delphi,firemonkey,core-text
I'm trying to display text using coretext. Now it's on a delphi form, but I have code which seems to work fine getting the context for drawing shapes on (it just gets the FContext field from the form). The text appears like this (it's upside down), it's suppose to be...

Is CoreText faster than Text Kit?

ios,uitableview,uicollectionview,core-text,textkit
In a case where I have a multiple custom UITableViewCells or UICollectionViewCells with several labels and UI elements, and maintaining good scroll-speed is essential, will CoreText be a faster solution than TextKit?

In a UILabel, is it possible to force a line NOT to break at slash?

ios,uilabel,core-text,hyphenation
Example: My text is @"This is a great UI/UX feature". A better example: @"5/17 of this quantity". Is it possible to force the line NOT to break at the / (the slash)? I'm looking for a general way of doing, since I have others sentences with slashes....

How does Apple's text rendering draw a glyph that a font doesn't have?

unicode,fonts,core-text
I have a basic understanding of fonts and encoding, but recently I had to do something outside of my comfort zone: Turn the character ✖ (0x2716 "heavy multiplication x") into a CGPathRef. I used Core Text's CTFontGetGlyphsForCharacters to accomplish this job. I understand that a CGGlyph is effectively an index...

NSForegroundColorAttributeName not working for UILabel

ios,objective-c,nsattributedstring,core-text
I have a problem changing substring color using "NSForegroundColorAttributeName". I'm confused since other attributes for the same substring are being applied(underline). Also tried to use deprecated attribute "UITextAttributeTextColor" and other suggested attribute "kCTForegroundColorAttributeName" and got the same effect. I'm compiling for iOS 7. NSString *freeText = [NSString stringWithFormat:@"(%@)", self.me.activity.text]; int...

ios CoreText write to Pdf and word wrapping

ios,pdf,render,wrap,core-text
I'm using a slight modification of code from this excellent article from rawenderlich.com to write some text to a pdf: -(void)drawText:(NSString*)text inFrame:(CGRect)frameRect withAttributes:(NSDictionary*)attributes { CFStringRef stringRef = (__bridge CFStringRef)text; // Prepare the text using a Core Text Framesetter CFDictionaryRef attributeRef = (__bridge CFDictionaryRef)attributes; CFAttributedStringRef currentText = CFAttributedStringCreate(NULL, stringRef, attributeRef); CTFramesetterRef...

How can I vertically center a line in an NSAttributedString with different fonts?

ios,objective-c,nsattributedstring,core-text,nsparagraphstyle
I have a NSAttributedString which is a "table" using NSTextTab stops where the first column is the KEY and the second column is the value Like this: | **KEY 1**|value1| |**KEY TWO**|value2| The font for the KEYS is different size/weight + it is all caps. The rows align so that...

Vertical Text Alignment in Core Text

ios,objective-c,core-graphics,core-text,core-foundation
EDIT: Here's a Github Gist of the below code if that is more readable. I'm writing a method to draw text within a rectangle in a PDF using Core Text. What I've written accomplishes everything I need, except vertical alignment (top, center, bottom). The standard way that the text is...