Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Revert of JDK-7162125 because of found regressions
Browse files Browse the repository at this point in the history
--HG--
branch : 8u40-verified-fixes
  • Loading branch information
denis-fokin committed Dec 28, 2015
1 parent 69e76eb commit deb7383
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 541 deletions.
155 changes: 0 additions & 155 deletions src/macosx/classes/sun/font/CCompositeGlyphMapper.java

This file was deleted.

60 changes: 2 additions & 58 deletions src/macosx/classes/sun/font/CFont.java
Expand Up @@ -31,13 +31,12 @@
import java.awt.geom.GeneralPath;;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;

// Right now this class is final to avoid a problem with native code.
// For some reason the JNI IsInstanceOf was not working correctly
// so we are checking the class specifically. If we subclass this
// we need to modify the native code in CFontWrapper.m
public final class CFont extends PhysicalFont implements FontSubstitution {
public final class CFont extends PhysicalFont {

/* CFontStrike doesn't call these methods so they are unimplemented.
* They are here to meet the requirements of PhysicalFont, needed
Expand Down Expand Up @@ -77,20 +76,6 @@ GeneralPath getGlyphVectorOutline(long pScalerContext,
throw new InternalError("Not implemented");
}

@Override
protected long getLayoutTableCache() {
return getLayoutTableCacheNative(getNativeFontPtr());
}

@Override
protected byte[] getTableBytes(int tag) {
return getTableBytesNative(getNativeFontPtr(), tag);
}

private native synchronized long getLayoutTableCacheNative(long nativeFontPtr);

private native byte[] getTableBytesNative(long nativeFontPtr, int tag);

private static native long createNativeFont(final String nativeFontName,
final int style);
private static native void disposeNativeFont(final long nativeFontPtr);
Expand Down Expand Up @@ -194,51 +179,10 @@ public CFont createItalicVariant() {
protected synchronized long getNativeFontPtr() {
if (nativeFontPtr == 0L) {
nativeFontPtr = createNativeFont(nativeFontName, style);
}
}
return nativeFontPtr;
}

static native void getCascadeList(long nativeFontPtr, ArrayList<String> listOfString);

private CompositeFont createCompositeFont() {
ArrayList<String> listOfString = new ArrayList<String>();
getCascadeList(nativeFontPtr, listOfString);

FontManager fm = FontManagerFactory.getInstance();
int numFonts = 1 + listOfString.size();
PhysicalFont[] fonts = new PhysicalFont[numFonts];
fonts[0] = this;
int idx = 1;
for (String s : listOfString) {
if (s.equals(".AppleSymbolsFB")) {
// Don't know why we get the weird name above .. replace.
s = "AppleSymbols";
}
Font2D f2d = fm.findFont2D(s, Font.PLAIN, FontManager.NO_FALLBACK);
if (f2d == null || f2d == this) {
continue;
}
fonts[idx++] = (PhysicalFont)f2d;
}
if (idx < fonts.length) {
PhysicalFont[] orig = fonts;
fonts = new PhysicalFont[idx];
System.arraycopy(orig, 0, fonts, 0, idx);
}
CompositeFont compFont = new CompositeFont(fonts);
compFont.mapper = new CCompositeGlyphMapper(compFont);
return compFont;
}

private CompositeFont compFont;

public CompositeFont getCompositeFont2D() {
if (compFont == null) {
compFont = createCompositeFont();
}
return compFont;
}

protected synchronized void finalize() {
if (nativeFontPtr != 0) {
disposeNativeFont(nativeFontPtr);
Expand Down
2 changes: 1 addition & 1 deletion src/macosx/classes/sun/font/CStrike.java
Expand Up @@ -31,7 +31,7 @@

import sun.awt.SunHints;

public final class CStrike extends PhysicalStrike {
public final class CStrike extends FontStrike {

// Creates the native strike
private static native long createNativeStrikePtr(long nativeFontPtr,
Expand Down
3 changes: 0 additions & 3 deletions src/macosx/native/sun/font/AWTFont.h
Expand Up @@ -26,16 +26,13 @@
#import <Cocoa/Cocoa.h>
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>

#import "fontscalerdefs.h"

#define MAX_STACK_ALLOC_GLYPH_BUFFER_SIZE 256

@interface AWTFont : NSObject {
@public
NSFont *fFont;
CGFontRef fNativeCGFont;
BOOL fIsFakeItalic;
TTLayoutTableCache* layoutTableCache;
}

+ (AWTFont *) awtFontForName:(NSString *)name
Expand Down

0 comments on commit deb7383

Please sign in to comment.