mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JRE-748 Strange dots with fractional metrics turned on
port commit 82e7c82d from JBR 9 port from JBR 11 to JBR 15 (cherry picked from commite9bd5f5dad) cherry picked from commite0475e9ba2(cherry picked from commit714ba79a84)
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
CGFloat fSize;
|
||||
JRSFontRenderingStyle fStyle;
|
||||
jint fAAStyle;
|
||||
jint fFmHint;
|
||||
|
||||
CGAffineTransform fTx;
|
||||
CGAffineTransform fDevTx;
|
||||
@@ -41,6 +42,6 @@
|
||||
CGAffineTransform fFontTx;
|
||||
}
|
||||
|
||||
+ (AWTStrike *) awtStrikeForFont:(AWTFont *)awtFont tx:(CGAffineTransform)tx invDevTx:(CGAffineTransform)invDevTx style:(JRSFontRenderingStyle)style aaStyle:(jint)aaStyle;
|
||||
+ (AWTStrike *) awtStrikeForFont:(AWTFont *)awtFont tx:(CGAffineTransform)tx invDevTx:(CGAffineTransform)invDevTx style:(JRSFontRenderingStyle)style aaStyle:(jint)aaStyle fmHint:(jint)fmHint;
|
||||
|
||||
@end
|
||||
|
||||
@@ -40,13 +40,15 @@ static CGAffineTransform sInverseTX = { 1, 0, 0, -1, 0, 0 };
|
||||
tx:(CGAffineTransform)tx
|
||||
invDevTx:(CGAffineTransform)invDevTx
|
||||
style:(JRSFontRenderingStyle)style
|
||||
aaStyle:(jint)aaStyle {
|
||||
aaStyle:(jint)aaStyle
|
||||
fmHint:(jint)fmHint {
|
||||
|
||||
self = [super init];
|
||||
if (self) {
|
||||
fAWTFont = [awtFont retain];
|
||||
fStyle = style;
|
||||
fAAStyle = aaStyle;
|
||||
fFmHint = fmHint;
|
||||
|
||||
fTx = tx; // composited glyph and device transform
|
||||
|
||||
@@ -76,12 +78,14 @@ static CGAffineTransform sInverseTX = { 1, 0, 0, -1, 0, 0 };
|
||||
tx:(CGAffineTransform)tx
|
||||
invDevTx:(CGAffineTransform)invDevTx
|
||||
style:(JRSFontRenderingStyle)style
|
||||
aaStyle:(jint)aaStyle {
|
||||
aaStyle:(jint)aaStyle
|
||||
fmHint:(jint)fmHint {
|
||||
|
||||
return [[[AWTStrike alloc] initWithFont:awtFont
|
||||
tx:tx invDevTx:invDevTx
|
||||
style:style
|
||||
aaStyle:aaStyle] autorelease];
|
||||
aaStyle:aaStyle
|
||||
fmHint:fmHint] autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -352,7 +356,7 @@ JNI_COCOA_ENTER(env);
|
||||
CGAffineTransform glyphTx = GetTxFromDoubles(env, glyphTxArray);
|
||||
CGAffineTransform invDevTx = GetTxFromDoubles(env, invDevTxArray);
|
||||
|
||||
awtStrike = [AWTStrike awtStrikeForFont:awtFont tx:glyphTx invDevTx:invDevTx style:style aaStyle:aaStyle]; // autoreleased
|
||||
awtStrike = [AWTStrike awtStrikeForFont:awtFont tx:glyphTx invDevTx:invDevTx style:style aaStyle:aaStyle fmHint:fmHint]; // autoreleased
|
||||
|
||||
if (awtStrike)
|
||||
{
|
||||
|
||||
@@ -567,14 +567,17 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
|
||||
}
|
||||
advance = CGSizeApplyAffineTransform(advance, strike->fDevTx);
|
||||
|
||||
int imageBytes = height * width * pixelSize;
|
||||
int extraPixelStorage = (strike->fAAStyle == sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_LCD_HRGB &&
|
||||
strike->fFmHint == sun_awt_SunHints_INTVAL_FRACTIONALMETRICS_ON) ? 3 : 0;
|
||||
|
||||
#ifdef USE_IMAGE_ALIGNED_MEMORY
|
||||
// create separate memory
|
||||
GlyphInfo *glyphInfo = (GlyphInfo *)malloc(sizeof(GlyphInfo));
|
||||
void *image = (void *)malloc(height * width * pixelSize);
|
||||
void *image = (void *)malloc(imageBytes + extraPixelStorage);
|
||||
#else
|
||||
// create a GlyphInfo struct fused to the image it points to
|
||||
GlyphInfo *glyphInfo = (GlyphInfo *)malloc(sizeof(GlyphInfo) +
|
||||
height * width * pixelSize);
|
||||
GlyphInfo *glyphInfo = (GlyphInfo *)malloc(sizeof(GlyphInfo) + imageBytes + extraPixelStorage);
|
||||
#endif
|
||||
|
||||
glyphInfo->advanceX = advance.width;
|
||||
@@ -592,6 +595,9 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
|
||||
glyphInfo->image = ((void *)glyphInfo) + sizeof(GlyphInfo);
|
||||
#endif
|
||||
|
||||
int i;
|
||||
for (i = 0; i < extraPixelStorage; i++) (glyphInfo->image)[imageBytes + i] = 0;
|
||||
|
||||
return glyphInfo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user