Questions tagged [ctfont]
18 questions
5
votes
2 answers
iPhone - Convert CTFont to UIFont?
I am trying to convert a CTFont to a UIFont without losing any of the styles and attributes such as:
Font Name
Font Size
Font color
Underlines
Bold
Italic
etc

aryaxt
- 76,198
- 92
- 293
- 442
5
votes
1 answer
How to convert a Swift String to an array of CGGlyph
This snippet can be used for drawing CGGlyphs with a CGContext:
//drawing
let coreGraphicsFont = CTFontCopyGraphicsFont(coreTextFont, nil)
CGContextSetFont(context, coreGraphicsFont);
CGContextSetFontSize(context,…

user965972
- 2,489
- 2
- 23
- 39
4
votes
3 answers
Determine if unicode character has a glyph in UIFont
I want to find out if a certain unicode character has a glyph representation even if by a cascading font. For example, let's say I am using UIFont.systemFont(withSize:18) and a string \u{1CDA} and would like to find out if this font will display…

andrewz
- 4,729
- 5
- 49
- 67
4
votes
1 answer
Custom font as fallback font for missing glyphs
I'm currently working on an app which displays some funky characters. They are proper unicode characters There is no system font that contains these glyphs on iOS, so I made a custom font that contains only these glyphs.
Now, I don't want to replace…

Mark Gaensicke
- 504
- 5
- 16
2
votes
1 answer
How to use UIFontDescriptor when CTFeatureTypeIdentifier is not available
I use the following snippet to get the font features:
let font = UIFont.systemFont(ofSize: 16)
let features: NSArray = CTFontCopyFeatures(font)!
print("properties = \(features)")
So If I see this:
{
CTFeatureTypeExclusive =…

Gizmodo
- 3,151
- 7
- 45
- 92
2
votes
1 answer
FontName from CTFontRef
I've a CTFontRef variable.
CTFontRef aFontRef;
Getting Size of Font was easy :
CGFloat aFontSize = CTFontGetSize(aFontRef);
Please help me in retrieving the FontName.
I'm expecting the FontName to be something like MarkerFelt-Wide.
But, when I…

Roshit
- 1,589
- 1
- 15
- 37
2
votes
0 answers
Core Text Font Manager failing to register font with certain scope throwing undocumented error code -2
I am downloading certain font file and storing it in documents directory. After downloading, I try to register this font file using following code:
@objc func registerAndSetFontTapped(_ sender: UIButton) {
var error: Unmanaged?
let…

Rohan Sanap
- 2,773
- 2
- 21
- 39
1
vote
1 answer
Objective-C - CTFont change font style?
I have a CTFont that contains a font style, and sumbolic traits.
I want to create a new font with a new style that inherits the symbolic traits of the first font.
How can I achieve this?
CTFontRef newFontWithoutTraits =…

aryaxt
- 76,198
- 92
- 293
- 442
1
vote
2 answers
Swift: How to I get the list of downloaded system fonts which support the localised language?
I will like to provide the list of fonts that support the localised language. I could not find anything in UIFont and Font; but found something in CTFont and implemented the code below.
HOWEVER, I keep getting warnings like "CoreText note: Client…

user14341201
- 212
- 1
- 9
1
vote
2 answers
Why does Core Text return Myriad Pro Semibold when requesting a bold version of Myriad Pro
I have the common Adobe Myriad Pro fonts installed. These include Myriad Pro Regular, Myriad Pro Bold and Myriad Pro Semibold. Assume that I have a CTFontRef baseFont that points to Myriad Pro Regular, and that the font size I desire is size. I run…

jlarcombe
- 699
- 5
- 6
1
vote
0 answers
Swift: get Unicode code points for glyphs of TTF font file?
Using Swift, is it possible to get the Unicode code points for the glyphs in a True Type Font (TTF) file?
The CGFont doesn't seem to include a reference to the cmap table required to map Unicode code points to glyphs.
The CTGlyphInfo class is close,…

Crashalot
- 33,605
- 61
- 269
- 439
1
vote
1 answer
CTFont with CTStringAttributes and NSMutableAttributedString crashes my app in xamarin
I'm trying to create NSMutableAttributedString and set its properties with SetProperties method. But my app crashes with error,
MonoTouch.Foundation.MonoTouchException exception - NSInvalidArgumentException Reason: unrecognized selector sent to…

Semuserable
- 454
- 6
- 24
1
vote
1 answer
CoreText - Performance warning when creating a CTFont?
I get the following warning when creating a CTFont.
CoreText performance note: Client requested font with PostScript name "ArialRoundedMTBold" using name "Arial Rounded MT Bold" instead.
// Creating Font
CTFontRef fontWithoutTrait =…

aryaxt
- 76,198
- 92
- 293
- 442
0
votes
1 answer
CTFontCopyName Returns null for the kCTFontSampleTextNameKey
I am trying to get the Sample text of a font.This is my coding.
NSString *fontFilePath=@"/Volumes/Work/Mac/Fonts/FONT FOLDER/Times New Roman Bold.ttf";
CFStringRef aCFString = (CFStringRef)fontFilePath;
CTFontRef fontRef =…

Aravindhan
- 15,608
- 10
- 56
- 71
0
votes
0 answers
How to get real positions of text glyphs
CTFontGetAdvancesForGlyphs returns an array with widths of each text glypth (letter).
How to get real positions for each glyph (letter) in a text string?
If I calculate a sum of all text glyphs a resulting valuer is larger than real text string.…

aleksid1
- 11
- 2