提交 30045719 编写于 作者: L lana

Merge

......@@ -365,10 +365,6 @@ ifeq ($(CC_VERSION),msvc)
# LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
BASELFLAGS = -nologo /opt:REF /incremental:no
ifdef MT
# VS2005, VS2008, and beyond: ask LINK to generate manifests for .dll & .exe
BASELFLAGS += /manifest
endif
LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
......
......@@ -159,9 +159,6 @@ else # LIBRARY
# build it into $(OBJDIR) so that the other generated files get put
# there, then copy just the DLL (and MAP file) to the requested directory.
#
# In VS2005 or VS2008 the link command creates a .manifest file that we want
# to insert into the linked artifact so we do not need to track it separately.
# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
$(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
@$(prep-target)
@$(MKDIR) -p $(OBJDIR)
......@@ -169,9 +166,6 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
-map:$(OBJDIR)/$(LIBRARY).map \
$(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \
$(OTHER_LCF) $(JAVALIB) $(LDLIBS)
ifdef MT
$(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2
endif
$(CP) $(OBJDIR)/$(@F) $@
$(install-module-file)
$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
......
......@@ -142,10 +142,15 @@ else
STACK_SIZE=1048576
endif
# In VS2005 or VS2008 the link command creates a .manifest file that we want
# to insert into the linked artifact so we do not need to track it separately.
IMVERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
$(OBJDIR)/$(PROGRAM).exe.manifest: $(JDK_TOPDIR)/src/windows/resource/java.manifest
@$(prep-target)
$(SED) 's%IMVERSION%$(IMVERSION)%g;s%PROGRAM%$(PROGRAM)%g' $< > $@
# We used a hand-crafted manifest file for all executables.
# It is tweaked to embed the build number and executable name.
# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF)
$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) $(OBJDIR)/$(PROGRAM).exe.manifest
@$(prep-target)
@set -- $?; \
$(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
......
......@@ -369,10 +369,6 @@ FONTCONFIGS_SRC = $(CLOSED_SRC)/solaris/classes/sun/awt/fontconfigs
_FONTCONFIGS = \
fontconfig.properties \
fontconfig.RedHat.properties \
fontconfig.RedHat.2.1.properties \
fontconfig.RedHat.3.properties \
fontconfig.RedHat.4.properties \
fontconfig.Sun.properties \
fontconfig.Turbo.properties \
fontconfig.SuSE.10.properties \
fontconfig.SuSE.11.properties
......@@ -388,9 +384,7 @@ ifeq ($(PLATFORM), solaris)
FONTCONFIGS_SRC = $(PLATFORM_SRC)/classes/sun/awt/fontconfigs
_FONTCONFIGS = \
fontconfig.properties \
fontconfig.5.9.properties \
fontconfig.5.8.properties
fontconfig.properties
FONTCONFIGS_SRC_PREFIX = $(PLATFORM).
......
......@@ -515,8 +515,7 @@ SUNWprivate_1.1 {
getDefaultConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_awt_X11FontManager_setNativeFontPath;
Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_font_SunFontManager_populateFontFileNameMap;
# CDE private entry point
......
......@@ -537,8 +537,7 @@ SUNWprivate_1.1 {
getDefaultConfig;
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_awt_X11FontManager_setNativeFontPath;
Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_font_SunFontManager_populateFontFileNameMap;
# CDE private entry point
......
......@@ -65,7 +65,7 @@ SUNWprivate_1.1 {
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_awt_FontDescriptor_initIDs;
Java_sun_awt_PlatformFont_initIDs;
......
......@@ -136,8 +136,25 @@ ifeq ($(PLATFORM), linux)
-I$(OPENWIN_HOME)/include
endif
# We have some odd logic here because some Solaris 10 updates
# have a render.h file that suggests gradients are supported, but
# the Xrender.h doesn't have the corresponding type definitions.
# Earlier updates have neither. We'd like to know if there's a mismatch.
# Whilst in the C preprocessor we can tell if the render.h define's are set
# we can't tell anything about C declarations.
# A grep of Xrender.h is the only way to know this. If they are absent
# we will set a flag indicating this mismatch and the JDK source file
# will interpret it to resolve the problem.
ifeq ($(PLATFORM), solaris)
CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions
OS_VERSION := $(shell uname -r)
XRENDER_H := $(OPENWIN_HOME)/share/include/X11/extensions/Xrender.h
ifeq ($(OS_VERSION),5.10)
LINEARGRADIENT_CNT := $(shell $(EGREP) -c XLinearGradient $(XRENDER_H))
ifeq ($(LINEARGRADIENT_CNT),0)
CFLAGS+= -DSOLARIS10_NO_XRENDER_STRUCTS
endif
endif
endif
ifeq ($(MILESTONE), internal)
......
......@@ -188,8 +188,7 @@ SUNWprivate_1.1 {
Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_awt_X11FontManager_getFontPath;
Java_sun_font_X11FontManager_setNativeFontPath;
Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_awt_X11GraphicsEnvironment_initDisplay;
Java_sun_awt_X11GraphicsEnvironment_initGLX;
Java_sun_awt_X11GraphicsEnvironment_initXRender;
......
......@@ -1387,203 +1387,13 @@ public abstract class CubicCurve2D implements Shape, Cloneable {
return false;
}
// Trivially accept if either endpoint is inside the rectangle
// (not on its border since it may end there and not go inside)
// Record where they lie with respect to the rectangle.
// -1 => left, 0 => inside, 1 => right
double x1 = getX1();
double y1 = getY1();
int x1tag = getTag(x1, x, x+w);
int y1tag = getTag(y1, y, y+h);
if (x1tag == INSIDE && y1tag == INSIDE) {
return true;
}
double x2 = getX2();
double y2 = getY2();
int x2tag = getTag(x2, x, x+w);
int y2tag = getTag(y2, y, y+h);
if (x2tag == INSIDE && y2tag == INSIDE) {
return true;
}
double ctrlx1 = getCtrlX1();
double ctrly1 = getCtrlY1();
double ctrlx2 = getCtrlX2();
double ctrly2 = getCtrlY2();
int ctrlx1tag = getTag(ctrlx1, x, x+w);
int ctrly1tag = getTag(ctrly1, y, y+h);
int ctrlx2tag = getTag(ctrlx2, x, x+w);
int ctrly2tag = getTag(ctrly2, y, y+h);
// Trivially reject if all points are entirely to one side of
// the rectangle.
if (x1tag < INSIDE && x2tag < INSIDE &&
ctrlx1tag < INSIDE && ctrlx2tag < INSIDE)
{
return false; // All points left
}
if (y1tag < INSIDE && y2tag < INSIDE &&
ctrly1tag < INSIDE && ctrly2tag < INSIDE)
{
return false; // All points above
}
if (x1tag > INSIDE && x2tag > INSIDE &&
ctrlx1tag > INSIDE && ctrlx2tag > INSIDE)
{
return false; // All points right
}
if (y1tag > INSIDE && y2tag > INSIDE &&
ctrly1tag > INSIDE && ctrly2tag > INSIDE)
{
return false; // All points below
}
// Test for endpoints on the edge where either the segment
// or the curve is headed "inwards" from them
// Note: These tests are a superset of the fast endpoint tests
// above and thus repeat those tests, but take more time
// and cover more cases
if (inwards(x1tag, x2tag, ctrlx1tag) &&
inwards(y1tag, y2tag, ctrly1tag))
{
// First endpoint on border with either edge moving inside
return true;
}
if (inwards(x2tag, x1tag, ctrlx2tag) &&
inwards(y2tag, y1tag, ctrly2tag))
{
// Second endpoint on border with either edge moving inside
return true;
}
// Trivially accept if endpoints span directly across the rectangle
boolean xoverlap = (x1tag * x2tag <= 0);
boolean yoverlap = (y1tag * y2tag <= 0);
if (x1tag == INSIDE && x2tag == INSIDE && yoverlap) {
return true;
}
if (y1tag == INSIDE && y2tag == INSIDE && xoverlap) {
return true;
}
// We now know that both endpoints are outside the rectangle
// but the 4 points are not all on one side of the rectangle.
// Therefore the curve cannot be contained inside the rectangle,
// but the rectangle might be contained inside the curve, or
// the curve might intersect the boundary of the rectangle.
double[] eqn = new double[4];
double[] res = new double[4];
if (!yoverlap) {
// Both y coordinates for the closing segment are above or
// below the rectangle which means that we can only intersect
// if the curve crosses the top (or bottom) of the rectangle
// in more than one place and if those crossing locations
// span the horizontal range of the rectangle.
fillEqn(eqn, (y1tag < INSIDE ? y : y+h), y1, ctrly1, ctrly2, y2);
int num = solveCubic(eqn, res);
num = evalCubic(res, num, true, true, null,
x1, ctrlx1, ctrlx2, x2);
// odd counts imply the crossing was out of [0,1] bounds
// otherwise there is no way for that part of the curve to
// "return" to meet its endpoint
return (num == 2 &&
getTag(res[0], x, x+w) * getTag(res[1], x, x+w) <= 0);
}
// Y ranges overlap. Now we examine the X ranges
if (!xoverlap) {
// Both x coordinates for the closing segment are left of
// or right of the rectangle which means that we can only
// intersect if the curve crosses the left (or right) edge
// of the rectangle in more than one place and if those
// crossing locations span the vertical range of the rectangle.
fillEqn(eqn, (x1tag < INSIDE ? x : x+w), x1, ctrlx1, ctrlx2, x2);
int num = solveCubic(eqn, res);
num = evalCubic(res, num, true, true, null,
y1, ctrly1, ctrly2, y2);
// odd counts imply the crossing was out of [0,1] bounds
// otherwise there is no way for that part of the curve to
// "return" to meet its endpoint
return (num == 2 &&
getTag(res[0], y, y+h) * getTag(res[1], y, y+h) <= 0);
}
// The X and Y ranges of the endpoints overlap the X and Y
// ranges of the rectangle, now find out how the endpoint
// line segment intersects the Y range of the rectangle
double dx = x2 - x1;
double dy = y2 - y1;
double k = y2 * x1 - x2 * y1;
int c1tag, c2tag;
if (y1tag == INSIDE) {
c1tag = x1tag;
} else {
c1tag = getTag((k + dx * (y1tag < INSIDE ? y : y+h)) / dy, x, x+w);
}
if (y2tag == INSIDE) {
c2tag = x2tag;
} else {
c2tag = getTag((k + dx * (y2tag < INSIDE ? y : y+h)) / dy, x, x+w);
}
// If the part of the line segment that intersects the Y range
// of the rectangle crosses it horizontally - trivially accept
if (c1tag * c2tag <= 0) {
return true;
}
// Now we know that both the X and Y ranges intersect and that
// the endpoint line segment does not directly cross the rectangle.
//
// We can almost treat this case like one of the cases above
// where both endpoints are to one side, except that we may
// get one or three intersections of the curve with the vertical
// side of the rectangle. This is because the endpoint segment
// accounts for the other intersection in an even pairing. Thus,
// with the endpoint crossing we end up with 2 or 4 total crossings.
//
// (Remember there is overlap in both the X and Y ranges which
// means that the segment itself must cross at least one vertical
// edge of the rectangle - in particular, the "near vertical side"
// - leaving an odd number of intersections for the curve.)
//
// Now we calculate the y tags of all the intersections on the
// "near vertical side" of the rectangle. We will have one with
// the endpoint segment, and one or three with the curve. If
// any pair of those vertical intersections overlap the Y range
// of the rectangle, we have an intersection. Otherwise, we don't.
// c1tag = vertical intersection class of the endpoint segment
//
// Choose the y tag of the endpoint that was not on the same
// side of the rectangle as the subsegment calculated above.
// Note that we can "steal" the existing Y tag of that endpoint
// since it will be provably the same as the vertical intersection.
c1tag = ((c1tag * x1tag <= 0) ? y1tag : y2tag);
// Now we have to calculate an array of solutions of the curve
// with the "near vertical side" of the rectangle. Then we
// need to sort the tags and do a pairwise range test to see
// if either of the pairs of crossings spans the Y range of
// the rectangle.
//
// Note that the c2tag can still tell us which vertical edge
// to test against.
fillEqn(eqn, (c2tag < INSIDE ? x : x+w), x1, ctrlx1, ctrlx2, x2);
int num = solveCubic(eqn, res);
num = evalCubic(res, num, true, true, null, y1, ctrly1, ctrly2, y2);
// Now put all of the tags into a bucket and sort them. There
// is an intersection iff one of the pairs of tags "spans" the
// Y range of the rectangle.
int tags[] = new int[num+1];
for (int i = 0; i < num; i++) {
tags[i] = getTag(res[i], y, y+h);
}
tags[num] = c1tag;
Arrays.sort(tags);
return ((num >= 1 && tags[0] * tags[1] <= 0) ||
(num >= 3 && tags[2] * tags[3] <= 0));
int numCrossings = rectCrossings(x, y, w, h);
// the intended return value is
// numCrossings != 0 || numCrossings == Curve.RECT_INTERSECTS
// but if (numCrossings != 0) numCrossings == INTERSECTS won't matter
// and if !(numCrossings != 0) then numCrossings == 0, so
// numCrossings != RECT_INTERSECT
return numCrossings != 0;
}
/**
......@@ -1602,20 +1412,32 @@ public abstract class CubicCurve2D implements Shape, Cloneable {
if (w <= 0 || h <= 0) {
return false;
}
// Assertion: Cubic curves closed by connecting their
// endpoints form either one or two convex halves with
// the closing line segment as an edge of both sides.
if (!(contains(x, y) &&
contains(x + w, y) &&
contains(x + w, y + h) &&
contains(x, y + h))) {
return false;
int numCrossings = rectCrossings(x, y, w, h);
return !(numCrossings == 0 || numCrossings == Curve.RECT_INTERSECTS);
}
private int rectCrossings(double x, double y, double w, double h) {
int crossings = 0;
if (!(getX1() == getX2() && getY1() == getY2())) {
crossings = Curve.rectCrossingsForLine(crossings,
x, y,
x+w, y+h,
getX1(), getY1(),
getX2(), getY2());
if (crossings == Curve.RECT_INTERSECTS) {
return crossings;
}
}
// Either the rectangle is entirely inside one of the convex
// halves or it crosses from one to the other, in which case
// it must intersect the closing line segment.
Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
return !rect.intersectsLine(getX1(), getY1(), getX2(), getY2());
// we call this with the curve's direction reversed, because we wanted
// to call rectCrossingsForLine first, because it's cheaper.
return Curve.rectCrossingsForCubic(crossings,
x, y,
x+w, y+h,
getX2(), getY2(),
getCtrlX2(), getCtrlY2(),
getCtrlX1(), getCtrlY1(),
getX1(), getY1(), 0);
}
/**
......
......@@ -151,6 +151,23 @@ public class FileFontStrike extends PhysicalStrike {
}
}
/* Amble fonts are better rendered unhinted although there's the
* inevitable fuzziness that accompanies this due to no longer
* snapping stems to the pixel grid. The exception is that in B&W
* mode they are worse without hinting. The down side to that is that
* B&W metrics will differ which normally isn't the case, although
* since AA mode is part of the measuring context that should be OK.
* We don't expect Amble to be installed in the Windows fonts folder.
* If we were to, then we'd also might want to disable using the
* native rasteriser path which is used for LCD mode for platform
* fonts. since we have no way to disable hinting by GDI.
* In the case of Amble, since its 'gasp' table says to disable
* hinting, I'd expect GDI to follow that, so likely it should
* all be consistent even if GDI used.
*/
boolean disableHinting = desc.aaHint != INTVAL_TEXT_ANTIALIAS_OFF &&
fileFont.familyName.startsWith("Amble");
/* If any of the values is NaN then substitute the null scaler context.
* This will return null images, zero advance, and empty outlines
* as no rendering need take place in this case.
......@@ -165,7 +182,7 @@ public class FileFontStrike extends PhysicalStrike {
pScalerContext = fileFont.getScaler().createScalerContext(matrix,
fileFont instanceof TrueTypeFont,
desc.aaHint, desc.fmHint,
boldness, italic);
boldness, italic, disableHinting);
}
mapper = fileFont.getMapper();
......@@ -566,10 +583,44 @@ public class FileFontStrike extends PhysicalStrike {
if (glyphCode >= INVISIBLE_GLYPHS) {
return 0f;
}
/* Notes on the (getUserAdv == false) case.
*
* Setting getUserAdv == false is internal to this class.
* If there's no graphics transform we can let
* getGlyphAdvance take its course, and potentially caching in
* advances arrays, except for signalling that
* getUserAdv == false means there is no need to create an image.
* It is possible that code already calculated the user advance,
* and it is desirable to take advantage of that work.
* But, if there's a transform and we want device advance, we
* can't use any values cached in the advances arrays - unless
* first re-transform them into device space using 'desc.devTx'.
* invertDevTx is null if the graphics transform is identity,
* a translate, or non-invertible. The latter case should
* not ever occur in the getUserAdv == false path.
* In other words its either null, or the inversion of a
* simple uniform scale. If its null, we can populate and
* use the advance caches as normal.
*
* If we don't find a cached value, obtain the device advance and
* return it. This will get stashed on the image by the caller and any
* subsequent metrics calls will be able to use it as is the case
* whenever an image is what is initially requested.
*
* Don't query if there's a value cached on the image, since this
* getUserAdv==false code path is entered solely when none exists.
*/
if (horizontalAdvances != null) {
advance = horizontalAdvances[glyphCode];
if (advance != Float.MAX_VALUE) {
return advance;
if (!getUserAdv && invertDevTx != null) {
Point2D.Float metrics = new Point2D.Float(advance, 0f);
desc.devTx.deltaTransform(metrics, metrics);
return metrics.x;
} else {
return advance;
}
}
} else if (segmentedCache && segHorizontalAdvances != null) {
int segIndex = glyphCode >> SEGSHIFT;
......@@ -577,11 +628,23 @@ public class FileFontStrike extends PhysicalStrike {
if (subArray != null) {
advance = subArray[glyphCode % SEGSIZE];
if (advance != Float.MAX_VALUE) {
return advance;
if (!getUserAdv && invertDevTx != null) {
Point2D.Float metrics = new Point2D.Float(advance, 0f);
desc.devTx.deltaTransform(metrics, metrics);
return metrics.x;
} else {
return advance;
}
}
}
}
if (!getUserAdv && invertDevTx != null) {
Point2D.Float metrics = new Point2D.Float();
fileFont.getGlyphMetrics(pScalerContext, glyphCode, metrics);
return metrics.x;
}
if (invertDevTx != null || !getUserAdv) {
/* If there is a device transform need x & y advance to
* transform back into user space.
......@@ -725,7 +788,7 @@ public class FileFontStrike extends PhysicalStrike {
return getGlyphMetrics(glyphCode, true);
}
private Point2D.Float getGlyphMetrics(int glyphCode, boolean getUserAdv) {
private Point2D.Float getGlyphMetrics(int glyphCode, boolean getImage) {
Point2D.Float metrics = new Point2D.Float();
// !!! or do we force sgv user glyphs?
......@@ -733,7 +796,7 @@ public class FileFontStrike extends PhysicalStrike {
return metrics;
}
long glyphPtr;
if (getImageWithAdvance && getUserAdv) {
if (getImageWithAdvance && getImage) {
/* A heuristic optimisation says that for most cases its
* worthwhile retrieving the image at the same time as the
* metrics. So here we get the image data even if its not
......@@ -750,9 +813,9 @@ public class FileFontStrike extends PhysicalStrike {
metrics.y = StrikeCache.unsafe.getFloat
(glyphPtr + StrikeCache.yAdvanceOffset);
/* advance is currently in device space, need to convert back
* into user space, unless getUserAdv == false.
* into user space.
* This must not include the translation component. */
if (invertDevTx != null && getUserAdv) {
if (invertDevTx != null) {
invertDevTx.deltaTransform(metrics, metrics);
}
} else {
......@@ -781,9 +844,9 @@ public class FileFontStrike extends PhysicalStrike {
if (value == null) {
fileFont.getGlyphMetrics(pScalerContext, glyphCode, metrics);
/* advance is currently in device space, need to convert back
* into user space, unless getUserAdv == false.
* into user space.
*/
if (invertDevTx != null && getUserAdv) {
if (invertDevTx != null) {
invertDevTx.deltaTransform(metrics, metrics);
}
value = new Point2D.Float(metrics.x, metrics.y);
......
......@@ -242,9 +242,10 @@ public abstract class FontScaler implements DisposerRecord {
freed when corresponding strike is being released.
*/
abstract long createScalerContext(double[] matrix,
boolean fontType,
int aa, int fm,
float boldness, float italic);
boolean fontType,
int aa, int fm,
float boldness, float italic,
boolean disableHinting);
/* Marks context as invalid because native scaler is invalid.
Notes:
......
......@@ -211,7 +211,8 @@ class FreetypeFontScaler extends FontScaler {
}
long createScalerContext(double[] matrix, boolean fontType,
int aa, int fm, float boldness, float italic) {
int aa, int fm, float boldness, float italic,
boolean disableHinting) {
if (nativeScaler != 0L) {
return createScalerContextNative(nativeScaler, matrix,
fontType, aa, fm, boldness, italic);
......
......@@ -67,7 +67,7 @@ class NullFontScaler extends FontScaler {
long getLayoutTableCache() {return 0L;}
long createScalerContext(double[] matrix, boolean fontType, int aa,
int fm, float boldness, float italic) {
int fm, float boldness, float italic, boolean disableHinting) {
return getNullScalerContext();
}
......
......@@ -1576,7 +1576,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
.info("Trying to resolve file " + fullPath);
}
do {
ttf = new TrueTypeFont(fullPath, null, fn++, true);
ttf = new TrueTypeFont(fullPath, null, fn++, false);
// prefer the font's locale name.
String fontName = ttf.getFontName(l).toLowerCase();
if (unmappedFonts.contains(fontName)) {
......@@ -1595,6 +1595,207 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
}
}
/* Hardwire the English names and expected file names of fonts
* commonly used at start up. Avoiding until later even the small
* cost of calling platform APIs to locate these can help.
* The code that registers these fonts needs to "bail" if any
* of the files do not exist, so it will verify the existence of
* all non-null file names first.
* They are added in to a map with nominally the first
* word in the name of the family as the key. In all the cases
* we are using the the family name is a single word, and as is
* more or less required the family name is the initial sequence
* in a full name. So lookup first finds the matching description,
* then registers the whole family, returning the right font.
*/
public static class FamilyDescription {
public String familyName;
public String plainFullName;
public String boldFullName;
public String italicFullName;
public String boldItalicFullName;
public String plainFileName;
public String boldFileName;
public String italicFileName;
public String boldItalicFileName;
}
static HashMap<String, FamilyDescription> platformFontMap;
/**
* default implementation does nothing.
*/
public HashMap<String, FamilyDescription> populateHardcodedFileNameMap() {
return new HashMap<String, FamilyDescription>(0);
}
Font2D findFontFromPlatformMap(String lcName, int style) {
if (platformFontMap == null) {
platformFontMap = populateHardcodedFileNameMap();
}
if (platformFontMap == null || platformFontMap.size() == 0) {
return null;
}
int spaceIndex = lcName.indexOf(' ');
String firstWord = lcName;
if (spaceIndex > 0) {
firstWord = lcName.substring(0, spaceIndex);
}
FamilyDescription fd = platformFontMap.get(firstWord);
if (fd == null) {
return null;
}
/* Once we've established that its at least the first word,
* we need to dig deeper to make sure its a match for either
* a full name, or the family name, to make sure its not
* a request for some other font that just happens to start
* with the same first word.
*/
int styleIndex = -1;
if (lcName.equalsIgnoreCase(fd.plainFullName)) {
styleIndex = 0;
} else if (lcName.equalsIgnoreCase(fd.boldFullName)) {
styleIndex = 1;
} else if (lcName.equalsIgnoreCase(fd.italicFullName)) {
styleIndex = 2;
} else if (lcName.equalsIgnoreCase(fd.boldItalicFullName)) {
styleIndex = 3;
}
if (styleIndex == -1 && !lcName.equalsIgnoreCase(fd.familyName)) {
return null;
}
String plainFile = null, boldFile = null,
italicFile = null, boldItalicFile = null;
boolean failure = false;
/* In a terminal server config, its possible that getPathName()
* will return null, if the file doesn't exist, hence the null
* checks on return. But in the normal client config we need to
* follow this up with a check to see if all the files really
* exist for the non-null paths.
*/
getPlatformFontDirs(noType1Font);
if (fd.plainFileName != null) {
plainFile = getPathName(fd.plainFileName);
if (plainFile == null) {
failure = true;
}
}
if (fd.boldFileName != null) {
boldFile = getPathName(fd.boldFileName);
if (boldFile == null) {
failure = true;
}
}
if (fd.italicFileName != null) {
italicFile = getPathName(fd.italicFileName);
if (italicFile == null) {
failure = true;
}
}
if (fd.boldItalicFileName != null) {
boldItalicFile = getPathName(fd.boldItalicFileName);
if (boldItalicFile == null) {
failure = true;
}
}
if (failure) {
if (FontUtilities.isLogging()) {
FontUtilities.getLogger().
info("Hardcoded file missing looking for " + lcName);
}
platformFontMap.remove(firstWord);
return null;
}
/* Some of these may be null,as not all styles have to exist */
final String[] files = {
plainFile, boldFile, italicFile, boldItalicFile } ;
failure = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Boolean>() {
public Boolean run() {
for (int i=0; i<files.length; i++) {
if (files[i] == null) {
continue;
}
File f = new File(files[i]);
if (!f.exists()) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
});
if (failure) {
if (FontUtilities.isLogging()) {
FontUtilities.getLogger().
info("Hardcoded file missing looking for " + lcName);
}
platformFontMap.remove(firstWord);
return null;
}
/* If we reach here we know that we have all the files we
* expect, so all should be fine so long as the contents
* are what we'd expect. Now on to registering the fonts.
* Currently this code only looks for TrueType fonts, so format
* and rank can be specified without looking at the filename.
*/
Font2D font = null;
for (int f=0;f<files.length;f++) {
if (files[f] == null) {
continue;
}
PhysicalFont pf =
registerFontFile(files[f], null,
FONTFORMAT_TRUETYPE, false, Font2D.TTF_RANK);
if (f == styleIndex) {
font = pf;
}
}
/* Two general cases need a bit more work here.
* 1) If font is null, then it was perhaps a request for a
* non-existent font, such as "Tahoma Italic", or a family name -
* where family and full name of the plain font differ.
* Fall back to finding the closest one in the family.
* This could still fail if a client specified "Segoe" instead of
* "Segoe UI".
* 2) The request is of the form "MyFont Bold", style=Font.ITALIC,
* and so we want to see if there's a Bold Italic font, or
* "MyFamily", style=Font.BOLD, and we may have matched the plain,
* but now need to revise that to the BOLD font.
*/
FontFamily fontFamily = FontFamily.getFamily(fd.familyName);
if (fontFamily != null) {
if (font == null) {
font = fontFamily.getFont(style);
if (font == null) {
font = fontFamily.getClosestStyle(style);
}
} else if (style > 0 && style != font.style) {
style |= font.style;
font = fontFamily.getFont(style);
if (font == null) {
font = fontFamily.getClosestStyle(style);
}
}
}
return font;
}
private synchronized HashMap<String,String> getFullNameToFileMap() {
if (fontToFileMap == null) {
......@@ -1998,6 +2199,17 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
}
if (FontUtilities.isWindows) {
font = findFontFromPlatformMap(lowerCaseName, style);
if (FontUtilities.isLogging()) {
FontUtilities.getLogger()
.info("findFontFromPlatformMap returned " + font);
}
if (font != null) {
fontNameCache.put(mapName, font);
return font;
}
/* Don't want Windows to return a Lucida Sans font from
* C:\Windows\Fonts
*/
......@@ -2221,7 +2433,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return FontUtilities.getFont2D(font).supportsEncoding(encoding);
}
public abstract String getFontPath(boolean noType1Fonts);
protected abstract String getFontPath(boolean noType1Fonts);
private Thread fileCloser = null;
Vector<File> tmpFontFiles = null;
......@@ -2934,8 +3146,15 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
}
}
protected String[] getPlatformFontDirs(boolean noType1Fonts) {
String path = getFontPath(true);
/* First check if we already initialised path dirs */
if (pathDirs != null) {
return pathDirs;
}
String path = getPlatformFontPath(noType1Fonts);
StringTokenizer parser =
new StringTokenizer(path, File.pathSeparator);
ArrayList<String> pathList = new ArrayList<String>();
......@@ -2945,7 +3164,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
}
} catch (NoSuchElementException e) {
}
return pathList.toArray(new String[0]);
pathDirs = pathList.toArray(new String[0]);
return pathDirs;
}
/**
......@@ -3047,7 +3267,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
/* A call to this method should be followed by a call to
* registerFontDirs(..)
*/
protected String getPlatformFontPath(boolean noType1Font) {
public String getPlatformFontPath(boolean noType1Font) {
if (fontPath == null) {
fontPath = getFontPath(noType1Font);
}
......
......@@ -165,7 +165,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
return new SunGraphics2D(sd, Color.white, Color.black, defaultFont);
}
private static FontManagerForSGE getFontManagerForSGE() {
public static FontManagerForSGE getFontManagerForSGE() {
FontManager fm = FontManagerFactory.getInstance();
return (FontManagerForSGE) fm;
}
......
......@@ -161,11 +161,11 @@ typedef short INT16;
/* INT32 must hold at least signed 32-bit values. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
#ifndef _LP64
typedef long INT32;
#else
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
#if defined(_LP64) || defined(_WIN32) /* _WIN32 is on all windows platfroms (x86 and x64) */
typedef int INT32;
#else
typedef long INT32;
#endif
#endif
......@@ -221,11 +221,14 @@ typedef unsigned int JDIMENSION;
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
*/
#ifndef FAR
#ifdef NEED_FAR_POINTERS
#define FAR far
#else
#define FAR
#endif
#endif
/*
......
......@@ -224,6 +224,7 @@ void FontInstanceAdapter::getWideGlyphAdvance(le_uint32 glyph, LEPoint &advance)
if (pt != NULL) {
advance.fX = env->GetFloatField(pt, sunFontIDs.xFID);
advance.fY = env->GetFloatField(pt, sunFontIDs.yFID);
env->DeleteLocalRef(pt);
}
}
......
......@@ -137,7 +137,7 @@ void errorHandler(cmsContext ContextID, cmsUInt32Number errorCode,
JNU_ThrowByName(env, "java/awt/color/CMMException", errMsg);
}
JNIEXPORT int JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
javaVM = jvm;
cmsSetLogErrorHandler(errorHandler);
......
......@@ -718,25 +718,6 @@ public class X11FontManager extends SunFontManager {
fontdirs = (String[])fontConfigDirs.toArray(new String[0]);
}
/* Called by MToolkit to set the X11 font path */
public static void setNativeFontPath() {
if (fontdirs == null) {
return;
}
// need to register these individually rather than by one call
// to ensure that one bad directory doesn't cause all to be rejected
for (int i=0; i<fontdirs.length; i++) {
if (FontUtilities.debugFonts()) {
FontUtilities.getLogger().info("Add " + fontdirs[i] + " to X11 fontpath");
}
setNativeFontPath(fontdirs[i]);
}
}
private synchronized static native void setNativeFontPath(String fontPath);
// Implements SunGraphicsEnvironment.createFontConfiguration.
protected FontConfiguration createFontConfiguration() {
/* The logic here decides whether to use a preconfigured
......@@ -780,7 +761,12 @@ public class X11FontManager extends SunFontManager {
preferLocaleFonts, preferPropFonts);
}
public synchronized native String getFontPath(boolean noType1Fonts);
public synchronized native String getFontPathNative(boolean noType1Fonts);
protected synchronized String getFontPath(boolean noType1Fonts) {
isHeadless(); // make sure GE is inited, as its the X11 lock.
return getFontPathNative(noType1Fonts);
}
public String[] getDefaultPlatformFont() {
if (defaultPlatformFont != null) {
......
......@@ -166,10 +166,7 @@ public class MFontConfiguration extends FontConfiguration {
} else if (osName.equals("Linux")) {
try {
File f;
if ((f = new File("/etc/sun-release")).canRead()) {
osName = "Sun";
osVersion = getVersionString(f);
} else if ((f = new File("/etc/fedora-release")).canRead()) {
if ((f = new File("/etc/fedora-release")).canRead()) {
osName = "Fedora";
osVersion = getVersionString(f);
} else if ((f = new File("/etc/redhat-release")).canRead()) {
......
......@@ -120,13 +120,6 @@ public class MToolkit extends UNIXToolkit implements Runnable {
getDefaultConfiguration());
}
/* Add font properties font directories to the X11 font path.
* Its called here *after* the X connection has been initialised
* and when we know that MToolkit is the one that will be used,
* since XToolkit doesn't need the X11 font path set
*/
X11FontManager.getInstance().setNativeFontPath();
motifdnd = ((Boolean)java.security.AccessController.doPrivileged(
new GetBooleanAction("awt.dnd.motifdnd"))).booleanValue();
}
......
......@@ -320,9 +320,6 @@ public class FcFontConfiguration extends FontConfiguration {
} else if ((f = new File("/etc/fedora-release")).canRead()) {
osName = "Fedora";
osVersion = getVersionString(f);
} else if ((f = new File("/etc/sun-release")).canRead()) {
osName = "Sun";
osVersion = getVersionString(f);
}
} catch (Exception e) {
if (FontUtilities.debugFonts()) {
......
......@@ -214,8 +214,9 @@ public class FontConfigManager {
if (FontUtilities.isLogging()) {
PlatformLogger logger = FontUtilities.getLogger();
logger.info("Fontconfig returned no fonts at all.");
return;
}
fontConfigFailed = true;
return;
} else if (fontConfigFailed) {
for (int i = 0; i< fontArr.length; i++) {
if (fontArr[i].firstFont == null) {
......
......@@ -502,6 +502,13 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
#ifdef __linux__ /* There's no headless build on linux ... */
if (!AWTIsHeadless()) { /* .. so need to call a function to check */
#endif
/* Using the X11 font path to locate font files is now a fallback
* useful only if fontconfig failed, or is incomplete. So we could
* remove this code completely and the consequences should be rare
* and non-fatal. If this happens, then the calling Java code can
* be modified to no longer require that the AWT lock (the X11GE)
* be initialised prior to calling this code.
*/
AWT_LOCK();
if (isDisplayLocal(env)) {
x11dirs = getX11FontPath();
......@@ -527,7 +534,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
return path;
}
JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath
JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPathNative
(JNIEnv *env, jobject thiz, jboolean noType1) {
jstring ret;
static char *ptr = NULL; /* retain result across calls */
......@@ -539,71 +546,6 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath
return ret;
}
/*
* In general setting the font path in a remote display situation is
* problematic. But for Solaris->Solaris the paths needed by the JRE should
* also be available to the server, although we have no way to check this
* for sure.
* So set the font path if we think its safe to do so:
* All Solaris X servers at least back to 2.6 and up to Solaris 10
* define the exact same vendor string.
* The version number for Solaris 2.6 is 3600, for 2.7 is 3610 and
* for Solaris 8 6410
* we want to set the font path only for 2.8 and onwards. Earlier releases
* are unlikely to have the right fonts and can't install "all locales"
* as needed to be sure. Also Solaris 8 is the earliest release supported
* by 1.5.
*/
#ifndef HEADLESS
static int isSunXServer() {
#ifdef __solaris__
return ((strncmp(ServerVendor(awt_display), "Sun Microsystems, Inc.", 22) == 0) ||
(strncmp(ServerVendor(awt_display), "Oracle Corporation", 18) == 0) &&
VendorRelease(awt_display) >= 6410);
#else
return 0;
#endif /* __solaris__ */
}
/* Avoid re-doing work for every call to setNativeFontPath */
static int doSetFontPath = -1;
static int shouldSetXFontPath(JNIEnv *env) {
if (doSetFontPath == -1) {
doSetFontPath =
awt_display != NULL && (isDisplayLocal(env) || isSunXServer());
}
return doSetFontPath;
}
#endif /* !HEADLESS */
JNIEXPORT void JNICALL Java_sun_font_X11FontManager_setNativeFontPath
(JNIEnv *env, jclass obj, jstring theString) {
#ifdef HEADLESS
return;
#else
fDirRecord fDir;
const char *theChars;
if (awt_display == NULL) {
return;
}
AWT_LOCK();
if (shouldSetXFontPath(env)) {
theChars = (*env)->GetStringUTFChars (env, theString, 0);
fDir.num = 1;
fDir.name[0] = theChars;
/* printf ("Registering the font path here %s \n", theChars ); */
AddFontsToX11FontPath ( &fDir );
if (theChars) {
(*env)->ReleaseStringUTFChars (env,
theString, (const char*)theChars);
}
}
AWT_UNLOCK();
#endif
}
#include <dlfcn.h>
#ifndef __linux__ /* i.e. is solaris */
#include <link.h>
......@@ -1178,6 +1120,7 @@ Java_sun_font_FontConfigManager_getFontConfig
}
pattern = (*FcNameParse)((FcChar8 *)fcName);
if (pattern == NULL) {
(*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
......@@ -1194,6 +1137,8 @@ Java_sun_font_FontConfigManager_getFontConfig
(*FcDefaultSubstitute)(pattern);
fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result);
if (fontset == NULL) {
(*FcPatternDestroy)(pattern);
(*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
......@@ -1211,6 +1156,21 @@ Java_sun_font_FontConfigManager_getFontConfig
file = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
if (family == NULL || styleStr == NULL ||
fullname == NULL || file == NULL) {
if (family != NULL) {
free(family);
}
if (styleStr != NULL) {
free(styleStr);
}
if (fullname != NULL) {
free(fullname);
}
if (file != NULL) {
free(file);
}
(*FcPatternDestroy)(pattern);
(*FcFontSetDestroy)(fontset);
(*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
......@@ -1237,6 +1197,14 @@ Java_sun_font_FontConfigManager_getFontConfig
result = (*FcPatternGetCharSet)(fontPattern,
FC_CHARSET, 0, &charset);
if (result != FcResultMatch) {
free(family);
free(family);
free(styleStr);
free(file);
(*FcPatternDestroy)(pattern);
(*FcFontSetDestroy)(fontset);
(*env)->ReleaseStringUTFChars(env,
fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
......
......@@ -31,6 +31,21 @@
#include <X11/extensions/Xrender.h>
/* On Solaris 10 updates 8, 9, the render.h file defines these
* protocol values but does not define the structs in Xrender.h.
* Thus in order to get these always defined on Solaris 10
* we will undefine the symbols if we have determined via the
* makefiles that Xrender.h is lacking the structs. This will
* trigger providing our own definitions as on earlier updates.
* We could assume that *all* Solaris 10 update versions will lack the updated
* Xrender.h and do this based solely on O/S being any 5.10 version, but this
* could still change and we'd be broken again as we'd be re-defining them.
*/
#ifdef SOLARIS10_NO_XRENDER_STRUCTS
#undef X_RenderCreateLinearGradient
#undef X_RenderCreateRadialGradient
#endif
#ifndef X_RenderCreateLinearGradient
typedef struct _XLinearGradient {
XPointFixed p1;
......
......@@ -63,7 +63,7 @@ public class Win32FontManager extends SunFontManager {
if (eudcFile != null) {
try {
eudcFont = new TrueTypeFont(eudcFile, null, 0,
true);
false);
} catch (FontFormatException e) {
}
}
......@@ -81,6 +81,10 @@ public class Win32FontManager extends SunFontManager {
*/
private static native String getEUDCFontFile();
public TrueTypeFont getEUDCFont() {
return eudcFont;
}
public Win32FontManager() {
super();
AccessController.doPrivileged(new PrivilegedAction() {
......@@ -137,6 +141,7 @@ public class Win32FontManager extends SunFontManager {
try {
while (!found && parser.hasMoreTokens()) {
String newPath = parser.nextToken();
boolean isJREFont = newPath.equals(jreFontDirName);
File theFile = new File(newPath, fontFileName);
if (theFile.canRead()) {
found = true;
......@@ -144,11 +149,11 @@ public class Win32FontManager extends SunFontManager {
if (defer) {
registerDeferredFont(fontFileName, path,
nativeNames,
fontFormat, true,
fontFormat, isJREFont,
fontRank);
} else {
registerFontFile(path, nativeNames,
fontFormat, true,
fontFormat, isJREFont,
fontRank);
}
break;
......@@ -197,7 +202,7 @@ public class Win32FontManager extends SunFontManager {
familyToFontListMap,
Locale locale);
public synchronized native String getFontPath(boolean noType1Fonts);
protected synchronized native String getFontPath(boolean noType1Fonts);
public String[] getDefaultPlatformFont() {
......@@ -277,4 +282,79 @@ public class Win32FontManager extends SunFontManager {
protected static native void deRegisterFontWithPlatform(String fontName);
/**
* populate the map with the most common windows fonts.
*/
@Override
public HashMap<String, FamilyDescription> populateHardcodedFileNameMap() {
HashMap<String, FamilyDescription> platformFontMap
= new HashMap<String, FamilyDescription>();
FamilyDescription fd;
/* Segoe UI is the default UI font for Vista and later, and
* is used by the Win L&F which is used by FX too.
* Tahoma is used for the Win L&F on XP.
* Verdana is used in some FX UI controls.
*/
fd = new FamilyDescription();
fd.familyName = "Segoe UI";
fd.plainFullName = "Segoe UI";
fd.plainFileName = "segoeui.ttf";
fd.boldFullName = "Segoe UI Bold";
fd.boldFileName = "segoeuib.ttf";
fd.italicFullName = "Segoe UI Italic";
fd.italicFileName = "segoeuii.ttf";
fd.boldItalicFullName = "Segoe UI Bold Italic";
fd.boldItalicFileName = "segoeuiz.ttf";
platformFontMap.put("segoe", fd);
fd = new FamilyDescription();
fd.familyName = "Tahoma";
fd.plainFullName = "Tahoma";
fd.plainFileName = "tahoma.ttf";
fd.boldFullName = "Tahoma Bold";
fd.boldFileName = "tahomabd.ttf";
platformFontMap.put("tahoma", fd);
fd = new FamilyDescription();
fd.familyName = "Verdana";
fd.plainFullName = "Verdana";
fd.plainFileName = "verdana.TTF";
fd.boldFullName = "Verdana Bold";
fd.boldFileName = "verdanab.TTF";
fd.italicFullName = "Verdana Italic";
fd.italicFileName = "verdanai.TTF";
fd.boldItalicFullName = "Verdana Bold Italic";
fd.boldItalicFileName = "verdanaz.TTF";
platformFontMap.put("verdana", fd);
/* The following are important because they are the core
* members of the default "Dialog" font.
*/
fd = new FamilyDescription();
fd.familyName = "Arial";
fd.plainFullName = "Arial";
fd.plainFileName = "ARIAL.TTF";
fd.boldFullName = "Arial Bold";
fd.boldFileName = "ARIALBD.TTF";
fd.italicFullName = "Arial Italic";
fd.italicFileName = "ARIALI.TTF";
fd.boldItalicFullName = "Arial Bold Italic";
fd.boldItalicFileName = "ARIALBI.TTF";
platformFontMap.put("arial", fd);
fd = new FamilyDescription();
fd.familyName = "Symbol";
fd.plainFullName = "Symbol";
fd.plainFileName = "Symbol.TTF";
platformFontMap.put("symbol", fd);
fd = new FamilyDescription();
fd.familyName = "WingDings";
fd.plainFullName = "WingDings";
fd.plainFileName = "WINGDING.TTF";
platformFontMap.put("wingdings", fd);
return platformFontMap;
}
}
......@@ -439,7 +439,14 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
MediaTray[] arr = new MediaTray[nTray];
int dmBin;
for (int i = 0, j=0; i < mediaTr.length; i++) {
/* Some drivers in Win 7 don't have the same length for DC_BINS and
* DC_BINNAMES so there is no guarantee that lengths of mediaTr and
* winMediaTrayNames are equal. To avoid getting ArrayIndexOutOfBounds,
* we need to make sure we get the minimum of the two.
*/
for (int i = 0, j=0; i < Math.min(mediaTr.length, winMediaTrayNames.length); i++) {
dmBin = mediaTr[i];
if (dmBin > 0) {
// check for unsupported DMBINs and create new Win32MediaTray
......
......@@ -396,7 +396,7 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_enumDisplayModesNative
UINT adapter;
// EnumAdapterModes treats 555 and 565 formats as equivalents
static D3DFORMAT formats[] =
{ D3DFMT_X8R8G8B8, D3DFMT_R5G6B5 };
{ D3DFMT_X8R8G8B8, D3DFMT_R5G6B5 };
J2dTraceLn(J2D_TRACE_INFO, "D3DGD_enumDisplayModesNative");
......@@ -404,7 +404,7 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_enumDisplayModesNative
RETURN_IF_NULL(pd3d9 = pMgr->GetD3DObject());
adapter = pMgr->GetAdapterOrdinalForScreen(gdiScreen);
for (formatNum = 0; formatNum < 3; formatNum++) {
for (formatNum = 0; formatNum < (sizeof formats)/(sizeof *formats); formatNum++) {
modesCount = pd3d9->GetAdapterModeCount(adapter, formats[formatNum]);
for (modeNum = 0; modeNum < modesCount; modeNum++) {
if (SUCCEEDED(pd3d9->EnumAdapterModes(adapter, formats[formatNum],
......
......@@ -2491,7 +2491,7 @@ Java_sun_awt_windows_WToolkit_loadSystemColors(JNIEnv *env, jobject self,
jint* colorsPtr = NULL;
try {
colorsPtr = (jint *)env->GetPrimitiveArrayCritical(colors, 0);
for (int i = 0; i < sizeof indexMap && i < colorLen; i++) {
for (int i = 0; i < (sizeof indexMap)/(sizeof *indexMap) && i < colorLen; i++) {
colorsPtr[i] = DesktopColor2RGB(indexMap[i]);
}
} catch (...) {
......
......@@ -214,6 +214,7 @@ Java_sun_awt_Win32FontManager_deRegisterFontWithPlatform(JNIEnv *env,
#define EUDCKEY_ZH_CN L"EUDC\\936"
#define EUDCKEY_ZH_TW L"EUDC\\950"
#define EUDCKEY_KO_KR L"EUDC\\949"
#define EUDCKEY_EN_US L"EUDC\\1252"
#define LANGID_JA_JP 0x411
#define LANGID_ZH_CN 0x0804
#define LANGID_ZH_SG 0x1004
......@@ -221,6 +222,7 @@ Java_sun_awt_Win32FontManager_deRegisterFontWithPlatform(JNIEnv *env,
#define LANGID_ZH_HK 0x0c04
#define LANGID_ZH_MO 0x1404
#define LANGID_KO_KR 0x0412
#define LANGID_EN_US 0x0409
JNIEXPORT jstring JNICALL
......@@ -237,6 +239,9 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
LANGID langID = GetSystemDefaultLangID();
//lookup for encoding ID, EUDC only supported in
//codepage 932, 936, 949, 950 (and unicode)
// On Windows 7, at least for me, it shows up in Cp1252 if
// I create a custom font. Might as well support that as it makes
// verification easier.
if (langID == LANGID_JA_JP) {
eudcKey = EUDCKEY_JA_JP;
} else if (langID == LANGID_ZH_CN || langID == LANGID_ZH_SG) {
......@@ -246,6 +251,8 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
eudcKey = EUDCKEY_ZH_TW;
} else if (langID == LANGID_KO_KR) {
eudcKey = EUDCKEY_KO_KR;
} else if (langID == LANGID_EN_US) {
eudcKey = EUDCKEY_EN_US;
} else {
return NULL;
}
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
>
<assemblyIdentity
version="1.0.0.0"
version="IMVERSION"
processorArchitecture="X86"
name="Oracle Corporation, Java(tm) 2 Standard Edition"
type="win32"
/>
<description>AWT</description>
<description>Java(TM) SE PROGRAM process</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
......@@ -19,4 +22,23 @@
/>
</dependentAssembly>
</dependency>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<!-- Indicate JDK is high-dpi aware. -->
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @bug 6925760
* @summary Scaled graphics causes overlapped LCD glyphs on Windows
*/
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
public class LCDScale extends Component {
public static void main(String args[]) {
Frame f = new Frame("TL TEST");
LCDScale td = new LCDScale();
f.add("Center", td);
f.pack(); f.setVisible(true);
}
public LCDScale() {
super();
}
public Dimension getPreferredSize() {
return new Dimension(500,500);
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
Font f = new Font("Dialog", Font.PLAIN, 40);
g.setFont(f);
FontRenderContext frc = g2d.getFontRenderContext();
GlyphVector gv = f.createGlyphVector(frc, "Help");
g2d.drawGlyphVector(gv, 10f, 50f);
Rectangle2D bds1 = gv.getLogicalBounds();
f = new Font("Arial", Font.PLAIN, 25);
g.setFont(f);
double s = 2.0;
AffineTransform tx = AffineTransform.getScaleInstance(s,s);
g2d.transform(tx);
frc = g2d.getFontRenderContext();
gv = f.createGlyphVector(frc, "Help");
g2d.drawGlyphVector(gv, 10f, 100f);
Rectangle2D bds2 = gv.getLogicalBounds();
System.out.println(bds1);
System.out.println(bds2);
if (bds2.getWidth()*s < bds1.getWidth()) {
throw new RuntimeException("Bounds too small");
}
}
}
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6958221
* @summary Test no crashing getting fonts on X11
* @run main X11FontPathCrashTest
*/
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
public class X11FontPathCrashTest {
public static void main(String[] args) {
new Font("nonexistentfont", Font.PLAIN, 12).getFamily();
}
}
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4935798 6521210 6901159
* @summary Tests that all family names that are reported in all locales
* correspond to some font returned from getAllFonts().
* @run main LocaleFamilyNames
*/
import java.awt.*;
import java.util.*;
public class LocaleFamilyNames {
public static void main(String[] args) throws Exception {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] all_fonts = ge.getAllFonts();
Locale[] all_locales = Locale.getAvailableLocales();
HashSet all_families = new HashSet();
for (int i=0; i<all_fonts.length; i++) {
all_families.add(all_fonts[i].getFamily());
for (int j=0; j<all_locales.length;j++) {
all_families.add(all_fonts[i].getFamily(all_locales[j]));
}
}
for (int i=0; i<all_locales.length; i++) {
String[] families_for_locale =
ge.getAvailableFontFamilyNames(all_locales[i]);
for (int j=0; j<families_for_locale.length; j++) {
if ( !all_families.contains(families_for_locale[j]) ) {
System.out.println("LOCALE: [" + all_locales[i]+"]");
System.out.print("NO FONT HAS " +
"THE FOLLOWING FAMILY NAME:");
System.out.println("["+families_for_locale[j]+"]");
throw new Exception("test failed");
}
}
}
}
}
......@@ -25,7 +25,7 @@
/**
* @test
* @bug 4485755 6361370 6448717 5080051
* @bug 4485755 6361370 6448717 5080051 6939417
* @summary dialog doesn't have way to specify margins
* for 6361370, verify exception for offline printer in Windows
* for 6448717, faster display of print dialog
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册