forked from KosmicTask/Fragaria
-
Notifications
You must be signed in to change notification settings - Fork 3
/
MGSGlyphGenerator.m
79 lines (59 loc) · 1.83 KB
/
MGSGlyphGenerator.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// MGSGlyphGenerator.m
// Fragaria
//
// Created by Jonathan on 23/09/2012.
//
//
#import "MGSGlyphGenerator.h"
@implementation MGSGlyphGenerator
/*
- generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:
*/
- (void)generateGlyphsForGlyphStorage:(id <NSGlyphStorage>)glyphStorage
desiredNumberOfCharacters:(NSUInteger)nChars
glyphIndex:(NSUInteger *)glyphIndex
characterIndex:(NSUInteger *)charIndex
{
NSGlyphGenerator *instance = [NSGlyphGenerator sharedGlyphGenerator];
_destination = glyphStorage;
[instance generateGlyphsForGlyphStorage:self desiredNumberOfCharacters:nChars glyphIndex:glyphIndex characterIndex:charIndex];
_destination = nil;
}
/*
- insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:
see https://svn.r-project.org/R-packages/trunk/Mac-GUI/RScriptEditorGlyphGenerator.m
*/
- (void)insertGlyphs:(const NSGlyph *)glyphs
length:(NSUInteger)length
forStartingGlyphAtIndex:(NSUInteger)glyphIndex
characterIndex:(NSUInteger)charIndex
{
// this is calling the layoutmanager method so glyph substitution can be performed there also
[_destination insertGlyphs:glyphs
length:length
forStartingGlyphAtIndex:glyphIndex
characterIndex:charIndex];
}
/*
- attributedString
*/
- (NSAttributedString *)attributedString
{
return [_destination attributedString];
}
/*
- layoutOptions
*/
- (NSUInteger)layoutOptions
{
return [_destination layoutOptions];
}
/*
- setIntAttribute:value:forGlyphAtIndex:
*/
- (void)setIntAttribute:(NSInteger)attributeTag value:(NSInteger)val forGlyphAtIndex:(NSUInteger)glyphIndex
{
[_destination setIntAttribute:attributeTag value:val forGlyphAtIndex:glyphIndex];
}
@end