@@ -356,7 +356,7 @@ @implementation CGGI_GlyphCanvas
356
356
} CGGI_GlyphInfoDescriptor;
357
357
358
358
typedef struct CGGI_RenderingMode {
359
- CGGI_GlyphInfoDescriptor *mainFontDescriptor ;
359
+ CGGI_GlyphInfoDescriptor *glyphDescriptor ;
360
360
JRSFontRenderingStyle cgFontMode;
361
361
bool lcdRendering;
362
362
bool subpixelResolution;
@@ -372,7 +372,7 @@ @implementation CGGI_GlyphCanvas
372
372
static inline CGGI_GlyphInfoDescriptor*
373
373
CGGI_GetGlyphInfoDescriptor (const CGGI_RenderingMode *mode, CTFontRef font)
374
374
{
375
- return IsEmojiFont (font) ? &argb : mode->mainFontDescriptor ;
375
+ return IsEmojiFont (font) ? &argb : mode->glyphDescriptor ;
376
376
}
377
377
378
378
static inline CGGI_RenderingMode
@@ -394,14 +394,14 @@ @implementation CGGI_GlyphCanvas
394
394
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_OFF:
395
395
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_ON:
396
396
mode.lcdRendering = false ;
397
- mode.mainFontDescriptor = &grey;
397
+ mode.glyphDescriptor = &grey;
398
398
break ;
399
399
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
400
400
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_LCD_HBGR:
401
401
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
402
402
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_LCD_VBGR:
403
403
mode.lcdRendering = true ;
404
- mode.mainFontDescriptor = &rgb;
404
+ mode.glyphDescriptor = &rgb;
405
405
break ;
406
406
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_GASP:
407
407
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_DEFAULT:
@@ -415,10 +415,6 @@ @implementation CGGI_GlyphCanvas
415
415
userInfo: nil ];
416
416
@throw e;
417
417
}
418
- if (IsEmojiFont ((CTFontRef)strike->fAWTFont ->fFont )) {
419
- mode.mainFontDescriptor = &argb;
420
- mode.subpixelResolution = false ;
421
- }
422
418
423
419
return mode;
424
420
}
@@ -844,12 +840,15 @@ static CTFontRef CopyFontWithSize(CTFontRef originalFont, CGFloat size) {
844
840
CGContextSetFont (canvas->context , strike->fAWTFont ->fNativeCGFont );
845
841
JRSFontSetRenderingStyleOnContext (canvas->context , strike->fStyle );
846
842
843
+ CTFontRef mainFont = (CTFontRef)strike->fAWTFont ->fFont ;
844
+ CGGI_GlyphInfoDescriptor* mainFontDescriptor = CGGI_GetGlyphInfoDescriptor (mode, mainFont);
845
+
847
846
const bool isMojaveOrAbove = IS_OSX_GT10_13;
848
847
CFIndex i;
849
848
for (i = 0 ; i < len; i++) {
850
849
GlyphInfo *info = (GlyphInfo *)jlong_to_ptr (glyphInfos[i]);
851
850
if (info != NULL ) {
852
- CGGI_CreateImageForGlyph (canvas, glyphs[i], info, mode-> mainFontDescriptor ,
851
+ CGGI_CreateImageForGlyph (canvas, glyphs[i], info, mainFontDescriptor,
853
852
strike, (CTFontRef)strike->fAWTFont ->fFont , isMojaveOrAbove);
854
853
} else {
855
854
info = CGGI_CreateImageForUnicode (canvas, strike, mode, uniChars[i], isMojaveOrAbove);
@@ -944,6 +943,7 @@ static CTFontRef CopyFontWithSize(CTFontRef originalFont, CGFloat size) {
944
943
945
944
CTFontRef fontRef = (CTFontRef)font->fFont ;
946
945
CGGlyphImages_GetGlyphMetrics (fontRef, &strike->fTx , strike->fSize , bboxCGMode, glyphs, len, bboxes, advances, IS_OSX_GT10_14);
946
+ CGGI_GlyphInfoDescriptor* mainFontDescriptor = CGGI_GetGlyphInfoDescriptor (mode, fontRef);
947
947
948
948
size_t maxWidth = 1 ;
949
949
size_t maxHeight = 1 ;
@@ -961,7 +961,7 @@ static CTFontRef CopyFontWithSize(CTFontRef originalFont, CGFloat size) {
961
961
CGRect bbox = bboxes[i];
962
962
963
963
GlyphInfo *glyphInfo = CGGI_CreateNewGlyphInfoFrom (advance, bbox, strike,
964
- mode-> mainFontDescriptor ,
964
+ mainFontDescriptor,
965
965
mode->subpixelResolution );
966
966
967
967
int w = glyphInfo->width * glyphInfo->subpixelResolutionX ;
0 commit comments