/*
* 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.
*/
#ifndef HEADLESS
#include "awt_p.h"
#include <string.h>
#include "java_awt_Component.h"
#include "java_awt_Font.h"
#include "java_awt_FontMetrics.h"
#include "sun_awt_motif_MToolkit.h"
#include "sun_awt_motif_X11FontMetrics.h"
#include "sun_awt_X11GraphicsEnvironment.h"
#include "awt_Font.h"
#include "java_awt_Dimension.h"
#include "multi_font.h"
#include "Disposer.h"
#endif /* !HEADLESS */
#include <jni.h>
#ifndef HEADLESS
#include <jni_util.h>
/* #define FONT_DEBUG 2 */
/* 1- print failures, 2- print all, 3- terminate on failure */
#if FONT_DEBUG
{
#if FONT_DEBUG < 2
#endif
#if FONT_DEBUG >= 3
exit(-1);
#endif
return result;
}
#endif
#endif /* !HEADLESS */
/*
* Class: java_awt_Font
* Method: initIDs
* Signature: ()V
*/
/* This function gets called from the static initializer for Font.java
to initialize the fieldIDs for fields that may be accessed from C */
{
#ifndef HEADLESS
/** We call "NoClientCode" methods because they won't invoke client
code on the privileged toolkit thread **/
#endif /* !HEADLESS */
}
#ifndef HEADLESS
/* fieldIDs for X11FontMetrics fields that may be accessed from C */
static struct X11FontMetricsIDs {
/*
* Class: sun_awt_motif_X11FontMetrics
* Method: initIDs
* Signature: ()V
*/
/* This function gets called from the static initializer for
X11FontMetrics.java to initialize the fieldIDs for fields
that may be accessed from C */
{
}
/* fieldIDs for FontDescriptor fields that may be accessed from C */
static struct FontDescriptorIDs {
#endif /* !HEADLESS */
/*
* Class: sun_awt_FontDescriptor
* Method: initIDs
* Signature: ()V
*/
/* This function gets called from the static initializer for
FontDescriptor.java to initialize the fieldIDs for fields
that may be accessed from C */
{
#ifndef HEADLESS
#endif /* !HEADLESS */
}
#ifndef HEADLESS
/*
* Class: sun_awt_motif_MFontPeer
* Method: initIDs
* Signature: ()V
*/
/* This function gets called from the static initializer for
MFontPeer.java to initialize the fieldIDs for fields
that may be accessed from C */
{
}
#endif /* !HEADLESS */
/*
* Class: sun_awt_PlatformFont
* Method: initIDs
* Signature: ()V
*/
/* This function gets called from the static initializer for
PlatformFont.java to initialize the fieldIDs for fields
that may be accessed from C */
{
#ifndef HEADLESS
"[Lsun/awt/FontDescriptor;");
"Lsun/awt/FontConfiguration;");
#endif /* !HEADLESS */
}
#ifndef HEADLESS
{
XFontStruct *f = NULL;
/* try the exact xlfd name in font configuration file */
if (f != NULL) {
return f;
}
/*
* try nearly font
*
* 1. specify FAMILY_NAME, WEIGHT_NAME, SLANT, POINT_SIZE,
* CHARSET_REGISTRY and CHARSET_ENCODING.
* 2. change POINT_SIZE to PIXEL_SIZE
* 3. change FAMILY_NAME to *
* 4. specify only PIXEL_SIZE and CHARSET_REGISTRY/ENCODING
* 5. change PIXEL_SIZE +1/-1/+2/-2...+4/-4
* 6. default font pattern
*/
{
/*
* This code assumes the name contains exactly 14 '-' delimiter.
* If not use default pattern.
*/
useDefault = TRUE;
} else {
}
#define NEXT_HYPHEN\
useDefault = TRUE;\
break;\
}\
*end = '\0'
do {
/* skip FOUNDRY */
/* set FAMILY_NAME */
/* set STYLE_NAME */
/* set SLANT */
/* skip SETWIDTH_NAME, ADD_STYLE_NAME, PIXEL_SIZE
POINT_SIZE, RESOLUTION_X, RESOLUTION_Y, SPACING
and AVERAGE_WIDTH */
/* set CHARSET_REGISTRY and CHARSET_ENCODING */
}
while (0);
#define TRY_LOAD\
if (f != NULL) {\
return f;\
}
if (!useDefault) {
/* Regular is the style for TrueType fonts -- Type1, F3 use roman */
altstyle = "roman";
}
family = "lucida";
}
#endif
/* try 1. */
"-*-%s-%s-%s-*-*-*-%d-*-*-*-*-%s",
"-*-%s-%s-%s-*-*-*-%d-*-*-*-*-%s",
}
/* search bitmap font */
/* try 2. */
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
}
/* try 3 */
"-*-*-%s-%s-*-*-%d-*-*-*-*-*-%s",
"-*-*-%s-%s-*-*-%d-*-*-*-*-*-%s",
}
/* try 4 */
"-*-*-*-%s-*-*-%d-*-*-*-*-*-%s",
/* try 5. */
"-*-*-*-*-*-*-%d-*-*-*-*-*-%s",
/* try 6. */
for (i = 1; i < 4; i++) {
if (pixelSize < i)
break;
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
"-*-*-*-*-*-*-%d-*-*-*-*-*-%s",
"-*-*-*-*-*-*-%d-*-*-*-*-*-%s",
}
}
}
}
/*
* Hardwired list of mappings for generic font names "Helvetica",
* "TimesRoman", "Courier", "Dialog", and "DialogInput".
*/
static char *
{
switch (s) {
case java_awt_Font_ITALIC:
return "medium-i";
case java_awt_Font_BOLD:
return "bold-r";
return "bold-i";
case java_awt_Font_PLAIN:
default:
return "medium-r";
}
}
static int32_t
{
return 0;
}
/* additional default font names */
*foundry = "adobe";
*facename = "times";
*foundry = "adobe";
*facename = "helvetica";
*foundry = "adobe";
*facename = "courier";
*foundry = "adobe";
*facename = "helvetica";
*foundry = "adobe";
*facename = "times";
*foundry = "adobe";
*facename = "courier";
*foundry = "b&h";
*facename = "lucida";
*foundry = "b&h";
*facename = "lucidatypewriter";
*foundry = "itc";
*facename = "zapfdingbats";
*encoding = "*-*";
} else {
#ifdef DEBUG
#endif
}
return 1;
}
struct FontData *
{
/* We are going to create at most 4 outstanding local refs in this
* function. */
return NULL;
}
return fdata;
}
/* We no longer need peer */
* fdata->charset_num);
for (i = 0; i < fdata->charset_num; i++) {
/*
* set xlfd name
*/
} else {
nativename = "";
}
+ strlen(defaultXLFD));
/*
* set charset_name
*/
/* We are done with the objects. */
/*
* set load & XFontStruct
*/
/*
* This appears to be a bogus check. The actual intent appears
* to be to find out whether this is the "base" font in a set,
* rather than iso8859_1 explicitly. Note that iso8859_15 will
* and must also pass this test.
*/
} else {
}
return NULL;
}
}
}
/*
* are used.
*/
return fdata;
} else {
}
}
return fdata;
}
}
}
while (1) {
name,
encoding);
/*fprintf(stderr,"LoadFont: %s\n", fontSpec); */
/* XXX: sometimes XLoadQueryFont returns a bogus font structure */
/* with negative ascent. */
}
/* Try any other foundry before messing with the sizes */
continue;
}
/* We couldn't find the font. We'll try to find an */
/* alternate by searching for heights above and below our */
/* preferred height. We try for 4 heights above and below. */
/* If we still can't find a font we repeat the algorithm */
/* using misc-fixed as the font. If we then fail, then we */
/* give up and signal an error. */
above++;
} else {
below++;
if (below > 4) {
continue;
} else {
}
}
}
}
continue;
} else {
}
} else {
}
return fdata;
}
}
/* not reached */
}
}
/*
* Class: sun_awt_motif_X11FontMetrics
* Method: getMFCharsWidth
*/
{
AWT_LOCK();
AWT_UNLOCK();
return retVal;
}
/*
* Class: sun_awt_motif_X11FontMetrics
* Method: bytesWidth
* Signature: ([BII)I
*/
{
jint w = 0;
return 0;
}
if (cnt == 0) {
return 0;
}
w = 0;
if (s == NULL) {
return 0;
}
while (--cnt >= 0) {
ch = *tmpPointer++;
w += tempWidths[ch];
} else {
w += maxAdvance;
}
}
} else {
w = maxAdvance * cnt;
}
return w;
}
/*
* Class: sun_awt_motif_X11FontMetrics
* Method: init
* Signature: ()V
*/
{
int32_t i = 0;
return;
}
AWT_LOCK();
AWT_UNLOCK();
return;
}
AWT_UNLOCK();
return;
}
/*
* Bug 4103248, 4120310. We must take all of the fonts into
* consideration in providing the metrics, not just the 8859-1 font,
* because the underlying Motif widgets are.
*/
}
fs_extents->max_logical_extent.y));
fs_extents->max_ink_extent.y));
} else {
}
AWT_UNLOCK();
return;
}
/*
* We could pin the array and then release it, but I believe this method
* is faster and perturbs the VM less
*
*/
for (i = 0; i <= ccount; i++) {
}
} else {
for (i = 0; i <= ccount; i++) {
}
}
AWT_UNLOCK();
}
/*
* Registered with the 2D disposer to be called after the Font is GC'd.
*/
{
int32_t i = 0;
AWT_LOCK();
AWT_UNLOCK();
return;
}
}
/* AWT fonts are always "multifonts" and probably have been in
* all post 1.0 releases, so this test test for multi fonts is
* probably not needed, and the singleton xfont is probably never used.
*/
if (fdata->charset_num > 0) {
for (i = 0; i < fdata->charset_num; i++) {
}
}
/* Don't free fdata->xfont because it is equal to fdata->flist[i].xfont
for some 'i' */
} else {
}
}
AWT_UNLOCK();
}
#endif /* !HEADLESS */