@@ -45,6 +45,14 @@ @implementation MTDisplay
45
45
46
46
- (void )draw : (CGContextRef )context
47
47
{
48
+ if (self.localBackgroundColor != nil ) {
49
+ CGContextSaveGState (context);
50
+ CGContextSetBlendMode (context, kCGBlendModeNormal );
51
+ CGContextSetFillColorWithColor (context, self.localBackgroundColor .CGColor );
52
+ CGContextFillRect (context, [self displayBounds ]);
53
+ CGContextRestoreGState (context);
54
+ }
55
+
48
56
}
49
57
50
58
- (CGRect ) displayBounds
@@ -154,6 +162,7 @@ - (void)dealloc
154
162
155
163
- (void )draw : (CGContextRef )context
156
164
{
165
+ [super draw: context];
157
166
CGContextSaveGState (context);
158
167
159
168
CGContextSetTextPosition (context, self.position .x , self.position .y );
@@ -212,6 +221,7 @@ - (void)setTextColor:(MTColor *)textColor
212
221
213
222
- (void )draw : (CGContextRef )context
214
223
{
224
+ [super draw: context];
215
225
CGContextSaveGState (context);
216
226
217
227
// Make the current position the origin as all the positions of the sub atoms are relative to the origin.
@@ -324,6 +334,7 @@ - (void)setTextColor:(MTColor *)textColor
324
334
325
335
- (void )draw : (CGContextRef )context
326
336
{
337
+ [super draw: context];
327
338
[_numerator draw: context];
328
339
[_denominator draw: context];
329
340
@@ -416,6 +427,7 @@ - (void)setTextColor:(MTColor *)textColor
416
427
417
428
- (void )draw : (CGContextRef )context
418
429
{
430
+ [super draw: context];
419
431
// draw the radicand & degree at its position
420
432
[self .radicand draw: context];
421
433
[self .degree draw: context];
@@ -474,6 +486,7 @@ - (instancetype)initWithGlpyh:(CGGlyph) glyph range:(NSRange) range font:(MTFont
474
486
475
487
- (void )draw : (CGContextRef )context
476
488
{
489
+ [super draw: context];
477
490
CGContextSaveGState (context);
478
491
479
492
[self .textColor setFill ];
@@ -530,6 +543,7 @@ - (instancetype)initWithGlyphs:(NSArray<NSNumber *> *)glyphs offsets:(NSArray<NS
530
543
531
544
- (void )draw : (CGContextRef )context
532
545
{
546
+ [super draw: context];
533
547
CGContextSaveGState (context);
534
548
535
549
[self .textColor setFill ];
@@ -671,6 +685,7 @@ - (void)setTextColor:(MTColor *)textColor
671
685
672
686
- (void )draw : (CGContextRef )context
673
687
{
688
+ [super draw: context];
674
689
// Draw the elements.
675
690
[self .upperLimit draw: context];
676
691
[self .lowerLimit draw: context];
@@ -703,6 +718,7 @@ - (void)setTextColor:(MTColor *)textColor
703
718
704
719
- (void )draw : (CGContextRef )context
705
720
{
721
+ [super draw: context];
706
722
[self .inner draw: context];
707
723
708
724
CGContextSaveGState (context);
@@ -770,6 +786,7 @@ - (void) updateAccenteePosition
770
786
771
787
- (void )draw : (CGContextRef )context
772
788
{
789
+ [super draw: context];
773
790
[self .accentee draw: context];
774
791
775
792
CGContextSaveGState (context);
0 commit comments