/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
/*
* Ideally there would be no native fonts used, and this class would be
* unneeded and removed. Presently it is still needed until such time
* as font configuration files (or the implementation equivalent) can have
* all references to fonts that are not handled via Java 2D removed.
* Currently there are two cases where this class is needed, both on
* Unix, primarily Solaris, but useful on Linux too if fonts have moved.
* can get dingbats and symbols from them. This can be dispensed with when
* either AWT is based on 2D, or when the X font path is known to always
* contain a Type1 or TrueType font that can be used in font configuration
* files to replace the F3 fonts.
* 2. When location of font files by 2D fails, because of some system
* configuration problem, it is desirable to have a fall back to some
* functionality that lessens the immediate impact on users. Being able
* to perform limited operations by using bitmaps from X11 helps here.
*/
boolean isBitmapDelegate;
/**
* Verifies native font is accessible.
* @throws FontFormatException - if the font can't be located.
*/
throws FontFormatException {
/* This is set true if this is an instance of a NativeFont
* created by some other font, to get native bitmaps.
* The delegating font will call this font only for "basic"
* cases - ie non-rotated, uniform scale, monochrome bitmaps.
* If this is false, then this instance may need to itself
* delegate to another font for non-basic cases. Since
* NativeFonts are used in that way only for symbol and dingbats
* we know its safe to delegate these to the JRE's default
* physical font (Lucida Sans Regular).
*/
if (GraphicsEnvironment.isHeadless()) {
throw new FontFormatException("Native font in headless toolkit");
}
initNames();
if (getNumGlyphs() == 0) {
}
}
/* Valid XLFD has exactly 14 "-" chars.
* First run over the string to verify have at least this many
* At the same time record the locations of the hyphens
* so we can just pick the right substring later on
*/
int[] hPos = new int[14];
int hyphenCnt = 1;
int pos = 1;
if (pos != -1) {
pos++;
}
}
}
/* Capitalise words in the Family name */
}
}
styleStr = "Bold";
}
styleStr = "Italic";
} else {
}
}
styleStr = "Oblique";
} else {
}
}
} else {
}
}
encoding = "dingbats";
encoding = "symbol";
} else {
encoding = "iso8859-1";
}
}
} else {
// familyName = "Unknown";
// fullName = "Unknown";
// style = Font.PLAIN;
// encoding = "iso8859-1";
}
}
/* Wildcard all the size fields in the XLFD and retrieve a list of
* XLFD's that match.
* We only look for scaleable fonts, so we can just replace the 0's
* with *'s and see what we get back
* No matches means even the scaleable version wasn't found. This is
* means the X font path isn't set up for this font at all.
* One match means only the scaleable version we started with was found
* -monotype-arial-bold-i-normal--0-0-0-0-p-0-iso8859-1
* Two matches apparently means as well as the above, a scaleable
* specified for 72 dpi is found, not that there are bitmaps : eg
* -monotype-arial-bold-i-normal--0-0-72-72-p-0-iso8859-1
* So require at least 3 matches (no need to parse) to determine that
* there are external bitmaps.
*/
/* Turn -monotype-arial-bold-i-normal--0-0-0-0-p-0-iso8859-1
* into -monotype-arial-bold-i-normal--*-*-*-*-p-*-iso8859-1
* by replacing all -0- substrings with -*-
*/
while (pos >=0) {
};
try {
} catch (UnsupportedEncodingException e) {
}
return haveBitmapFonts(bytes);
}
try {
} catch (UnsupportedEncodingException e) {
}
return fontExists(bytes);
}
if (isBitmapDelegate) {
/* we are a delegate */
mapper = new NativeGlyphMapper(this);
} else {
/* we need to delegate */
}
}
return mapper;
}
if (isBitmapDelegate) {
return new NativeStrike(this, desc);
} else {
if (delegateFont == null) {
}
/* If no FileFont's are found, delegate font may be
* a NativeFont, so we need to avoid recursing here.
*/
if (delegateFont instanceof NativeFont) {
}
}
}
return null;
}
int glyphCode) {
}
int glyphCode,
float x,
float y) {
return null;
}
throw new RuntimeException("this should be called on the strike");
}
float x, float y) {
return null;
}
public int getNumGlyphs() {
if (numGlyphs == -1) {
}
return numGlyphs;
}
if (delegateFont == null) {
}
return delegateFont;
}
/* Specify that the dpi is 72x72, as this corresponds to JDK's
* default user space. These are the 10th and 11th fields in the XLFD.
* ptSize in XLFD is in 10th's of a point so multiply by 10,
* Replace the 9th field in the XLFD (ie after the 8th hyphen)
* with this pt size (this corresponds to the field that's "%d" in the
* font configuration files). Wild card the other numeric fields.
* ie to request 12 pt Times New Roman italic font, use an XLFD like :
* -monotype-times new roman-regular-i---*-120-72-72-p-*-iso8859-1
*/
int[] hPos = new int[14];
int hyphenCnt = 1;
int pos = 1;
if (pos != -1) {
pos++;
}
}
/* work backwards so as to not invalidate the positions. */
/* replace the 3 lines above with the next 3 lines to get the 1.4.2
* behaviour
*/
// sb.replace(hPos[11]+1, hPos[12], "0");
// sb.replace(hPos[9]+1, hPos[10], "0");
// sb.replace(hPos[8]+1, hPos[9], "0");
/* replace the 1 line above with the next line to get the 1.4.2
* behaviour
*/
// sb.replace(hPos[6]+1, hPos[7], "0");
/* comment out this block to the the 1.4.2 behaviour */
/* null foundry name : some linux font configuration files have
* symbol font entries like this and its just plain wrong.
* Replace with a wild card. (Although those fonts should be
* located via disk access rather than X11).
*/
}
try {
} catch (UnsupportedEncodingException e) {
}
return bytes;
}
}
}