/*
* 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.
*/
/*
* Important note : All AWTxxx functions are defined in font.h.
* These were added to remove the dependency of this file on X11.
* These functions are used to perform X11 operations and should
* be "stubbed out" in environments that do not support X11.
* The implementation of these functions has been moved from this file
* into X11FontScaler_md.c, which is compiled into another library.
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <jni.h>
#include <jni_util.h>
#include "sun_font_NativeFont.h"
#include "sun_font_NativeStrike.h"
#include "sun_font_NativeStrikeDisposer.h"
#include "sunfontids.h"
#include "fontscalerdefs.h"
#include "X11FontScaler.h"
}
}
}
context->defaultGlyph = 0;
}
}
} else {
/* numGlyphs is an estimate : X11 doesn't provide a quick way to
* discover which glyphs are valid: just the range that contains all
* the valid glyphs, and this range may have holes.
*/
/* Sometimes the default_char field of the XFontStruct isn't
* initialized to anything, so it can be a large number. So,
* check to see if its less than the largest possible value
* and if so, then use it. Otherwise, just use the minGlyph.
*/
}
}
/*
* REMIND: freeing of native resources? XID, XFontStruct etc??
*/
}
/* JNIEXPORT jint JNICALL */
/* Java_sun_font_NativeFont_getItalicAngle */
/* (JNIEnv *env, jobject font) { */
/* UInt32 angle; */
/* AWTGetFontItalicAngle(xFont, &angle); */
/*X11 reports italic angle as 1/64ths of a degree, relative to 3 o'clock
* with anti-clockwise being the +ve rotation direction.
* We return
XGetFontProperty(xFont,XA_ITALIC_ANGLE, &angle);
*/
/* return (jint)angle; */
/* } */
int count = 0;
return JNI_FALSE;
}
if (count > 0) {
return JNI_TRUE;
} else {
return JNI_FALSE;
}
}
int count = 0;
return JNI_FALSE;
}
if (count > 2) {
return JNI_TRUE;
} else {
return JNI_FALSE;
}
}
// CountGlyphs doubles as way of getting a native font reference
// and telling if its valid. So far as I can tell GenerateImage etc
// just return if this "initialisation method" hasn't been called.
// So clients of this class need to call CountGlyphs() right after
// construction to be safe.
return 0;
} else {
return numGlyphs;
}
}
return (jint)0;
} else {
}
}
return advance;
}
}
/* If number of glyphs is 256 or less, the metrics are
* stored correctly in the XFontStruct for each
* character. If the # characters is more (double byte
* case), then these metrics seem flaky and there's no
* way to determine if they have been set or not.
*/
} else {
}
}
return (jlong)0;
}
return (jlong)0;
}
}
return (jlong)0;
}
}
}
return NULL;
}
/* the commented out lines are the old 1.4.x behaviour which used max
/* ay = (jfloat)-AWTCharAscent(AWTFontMaxBounds(xFont)); */
/* dy = (jfloat)AWTCharDescent(AWTFontMaxBounds(xFont)); */
/* ascent : no need to set ascentX - it will be zero
* descent : no need to set descentX - it will be zero
* baseline : old releases "made up" a number and also seemed to
* make it up for "X" and set "Y" to 0.
* leadingX : no need to set leadingX - it will be zero.
* leadingY : made-up number, but being compatible with what 1.4.x did
* advance : no need to set yMaxLinearAdvanceWidth - it will be zero.
*/
/* printf("X11 asc=%f dsc=%f adv=%f scale=%f\n", */
/* ay, dy, mx, (float)context->scale); */
return metrics;
}