Skip to content
Newer
Older
100644 80 lines (59 sloc) 1.83 KB
2255e3a @mugginsoft Fixed poor invisible character alignment problem for some fonts.
authored Sep 26, 2012
1 //
2 // MGSGlyphGenerator.m
3 // Fragaria
4 //
5 // Created by Jonathan on 23/09/2012.
6 //
7 //
8
9 #import "MGSGlyphGenerator.h"
10
11 @implementation MGSGlyphGenerator
12
13 /*
14
15 - generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:
16
17 */
18 - (void)generateGlyphsForGlyphStorage:(id <NSGlyphStorage>)glyphStorage
19 desiredNumberOfCharacters:(NSUInteger)nChars
20 glyphIndex:(NSUInteger *)glyphIndex
21 characterIndex:(NSUInteger *)charIndex
22 {
23 NSGlyphGenerator *instance = [NSGlyphGenerator sharedGlyphGenerator];
24
25 _destination = glyphStorage;
26 [instance generateGlyphsForGlyphStorage:self desiredNumberOfCharacters:nChars glyphIndex:glyphIndex characterIndex:charIndex];
27 _destination = nil;
28 }
29
30 /*
31
32 - insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:
33
34 see https://svn.r-project.org/R-packages/trunk/Mac-GUI/RScriptEditorGlyphGenerator.m
35
36 */
37 - (void)insertGlyphs:(const NSGlyph *)glyphs
38 length:(NSUInteger)length
39 forStartingGlyphAtIndex:(NSUInteger)glyphIndex
40 characterIndex:(NSUInteger)charIndex
41 {
42
43 // this is calling the layoutmanager method so glyph substitution can be performed there also
44 [_destination insertGlyphs:glyphs
45 length:length
46 forStartingGlyphAtIndex:glyphIndex
47 characterIndex:charIndex];
48 }
49
50 /*
51
52 - attributedString
53
54 */
55 - (NSAttributedString *)attributedString
56 {
57 return [_destination attributedString];
58 }
59
60 /*
61
62 - layoutOptions
63
64 */
65 - (NSUInteger)layoutOptions
66 {
67 return [_destination layoutOptions];
68 }
69
70 /*
71
72 - setIntAttribute:value:forGlyphAtIndex:
73
74 */
75 - (void)setIntAttribute:(NSInteger)attributeTag value:(NSInteger)val forGlyphAtIndex:(NSUInteger)glyphIndex
76 {
77 [_destination setIntAttribute:attributeTag value:val forGlyphAtIndex:glyphIndex];
78 }
79 @end
Something went wrong with that request. Please try again.