changeset 55797:2db64810f4fc

8224171: The cleanup multi-font related code in the XFontPeer Reviewed-by: prr
author serb
date Sun, 09 Jun 2019 18:14:48 -0700
parents 5c4f1b7c753b
children fe5395d16475
files src/java.desktop/unix/classes/sun/awt/X11/XFontPeer.java src/java.desktop/unix/native/common/awt/awt_Font.c src/java.desktop/unix/native/common/awt/awt_Font.h src/java.desktop/unix/native/common/awt/awt_p.h src/java.desktop/unix/native/libawt_xawt/awt/multi_font.c src/java.desktop/unix/native/libawt_xawt/awt/multi_font.h src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
diffstat 7 files changed, 6 insertions(+), 737 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/classes/sun/awt/X11/XFontPeer.java	Thu Jun 13 12:22:28 2019 +0530
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XFontPeer.java	Sun Jun 09 18:14:48 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -22,31 +22,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package sun.awt.X11;
 
 import sun.awt.PlatformFont;
-import java.awt.GraphicsEnvironment;
 
-public class XFontPeer extends PlatformFont {
+final class XFontPeer extends PlatformFont {
 
-    /*
-     * XLFD name for XFontSet.
-     */
-    private String xfsname;
-
-    static {
-        if (!GraphicsEnvironment.isHeadless()) {
-            initIDs();
-        }
-    }
-
-    /**
-     * Initialize JNI field and method IDs for fields that may be
-       accessed from C.
-     */
-    private static native void initIDs();
-
-    public XFontPeer(String name, int style){
+    XFontPeer(final String name, final int style) {
         super(name, style);
     }
 
--- a/src/java.desktop/unix/native/common/awt/awt_Font.c	Thu Jun 13 12:22:28 2019 +0530
+++ b/src/java.desktop/unix/native/common/awt/awt_Font.c	Sun Jun 09 18:14:48 2019 -0700
@@ -35,7 +35,6 @@
 #include "awt_Font.h"
 
 #include "java_awt_Dimension.h"
-#include "multi_font.h"
 #include "Disposer.h"
 #endif /* !HEADLESS */
 #include <jni.h>
@@ -436,269 +435,6 @@
     return 1;
 }
 
-struct FontData *
-awtJNI_GetFontData(JNIEnv * env, jobject font, char **errmsg)
-{
-    /* We are going to create at most 4 outstanding local refs in this
-     * function. */
-    if ((*env)->EnsureLocalCapacity(env, 4) < 0) {
-        return NULL;
-    }
-
-    if (!JNU_IsNull(env, font) && awtJNI_IsMultiFont(env, font)) {
-        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
-
-        struct FontData *fdata = NULL;
-        int32_t i, size;
-        char *fontsetname = NULL;
-        char *nativename = NULL;
-        Boolean doFree = FALSE;
-        jobjectArray componentFonts = NULL;
-        jobject peer = NULL;
-        jobject fontDescriptor = NULL;
-        jstring fontDescriptorName = NULL;
-        jstring charsetName = NULL;
-
-        fdata = (struct FontData *) JNU_GetLongFieldAsPtr(env,font,
-                                                         fontIDs.pData);
-
-        if (fdata != NULL && fdata->flist != NULL) {
-            return fdata;
-        }
-        size = (*env)->GetIntField(env, font, fontIDs.size);
-        fdata = (struct FontData *) malloc(sizeof(struct FontData));
-
-        peer = (*env)->CallObjectMethod(env, font, fontIDs.getPeer);
-
-        componentFonts =
-          (*env)->GetObjectField(env, peer, platformFontIDs.componentFonts);
-        /* We no longer need peer */
-        (*env)->DeleteLocalRef(env, peer);
-
-        fdata->charset_num = (*env)->GetArrayLength(env, componentFonts);
-
-        fdata->flist = (awtFontList *) malloc(sizeof(awtFontList)
-                                              * fdata->charset_num);
-        fdata->xfont = NULL;
-        for (i = 0; i < fdata->charset_num; i++) {
-            /*
-             * set xlfd name
-             */
-
-            fontDescriptor = (*env)->GetObjectArrayElement(env, componentFonts, i);
-            fontDescriptorName =
-              (*env)->GetObjectField(env, fontDescriptor,
-                                     fontDescriptorIDs.nativeName);
-
-            if (!JNU_IsNull(env, fontDescriptorName)) {
-                nativename = (char *) JNU_GetStringPlatformChars(env, fontDescriptorName, NULL);
-                if (nativename == NULL) {
-                    nativename = "";
-                    doFree = FALSE;
-                } else {
-                    doFree = TRUE;
-                }
-            } else {
-                nativename = "";
-                doFree = FALSE;
-            }
-
-            fdata->flist[i].xlfd = malloc(strlen(nativename)
-                                          + strlen(defaultXLFD));
-            jio_snprintf(fdata->flist[i].xlfd, strlen(nativename) + 10,
-                         nativename, size * 10);
-
-            if (nativename != NULL && doFree)
-                JNU_ReleaseStringPlatformChars(env, fontDescriptorName, (const char *) nativename);
-
-            /*
-             * set charset_name
-             */
-
-            charsetName =
-              (*env)->GetObjectField(env, fontDescriptor,
-                                     fontDescriptorIDs.charsetName);
-
-            fdata->flist[i].charset_name = (char *)
-                JNU_GetStringPlatformChars(env, charsetName, NULL);
-            if (fdata->flist[i].charset_name == NULL) {
-                (*env)->ExceptionClear(env);
-                JNU_ThrowOutOfMemoryError(env, "Could not create charset name");
-                return NULL;
-            }
-
-            /* We are done with the objects. */
-            (*env)->DeleteLocalRef(env, fontDescriptor);
-            (*env)->DeleteLocalRef(env, fontDescriptorName);
-            (*env)->DeleteLocalRef(env, charsetName);
-
-            /*
-             * set load & XFontStruct
-             */
-            fdata->flist[i].load = 0;
-
-            /*
-             * 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.
-             */
-
-            if (fdata->xfont == NULL &&
-                strstr(fdata->flist[i].charset_name, "8859_1")) {
-                fdata->flist[i].xfont =
-                    loadFont(awt_display, fdata->flist[i].xlfd, size * 10);
-                if (fdata->flist[i].xfont != NULL) {
-                    fdata->flist[i].load = 1;
-                    fdata->xfont = fdata->flist[i].xfont;
-                    fdata->flist[i].index_length = 1;
-                } else {
-                    /* Free any already allocated storage and fonts */
-                    int j = i;
-                    for (j = 0; j <= i; j++) {
-                        free((void *)fdata->flist[j].xlfd);
-                        JNU_ReleaseStringPlatformChars(env, NULL,
-                            fdata->flist[j].charset_name);
-                        if (fdata->flist[j].load) {
-                            XFreeFont(awt_display, fdata->flist[j].xfont);
-                        }
-                    }
-                    free((void *)fdata->flist);
-                    free((void *)fdata);
-
-                    if (errmsg != NULL) {
-                        *errmsg = "java/lang" "NullPointerException";
-                    }
-                    (*env)->DeleteLocalRef(env, componentFonts);
-                    return NULL;
-                }
-            }
-        }
-        (*env)->DeleteLocalRef(env, componentFonts);
-        /*
-         * XFontSet will create if the peer of TextField/TextArea
-         * are used.
-         */
-        fdata->xfs = NULL;
-
-        JNU_SetLongFieldFromPtr(env,font,fontIDs.pData,fdata);
-        Disposer_AddRecord(env, font, pDataDisposeMethod, ptr_to_jlong(fdata));
-        return fdata;
-    } else {
-        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
-        Display *display = NULL;
-        struct FontData *fdata = NULL;
-        char fontSpec[1024];
-        int32_t height;
-        int32_t oheight;
-        int32_t above = 0;              /* tries above height */
-        int32_t below = 0;              /* tries below height */
-        char *foundry = NULL;
-        char *name = NULL;
-        char *encoding = NULL;
-        char *style = NULL;
-        XFontStruct *xfont = NULL;
-        jstring family = NULL;
-
-        if (JNU_IsNull(env, font)) {
-            if (errmsg != NULL) {
-                *errmsg = "java/lang" "NullPointerException";
-            }
-            return (struct FontData *) NULL;
-        }
-        display = XDISPLAY;
-
-        fdata = (struct FontData *) JNU_GetLongFieldAsPtr(env,font,fontIDs.pData);
-        if (fdata != NULL && fdata->xfont != NULL) {
-            return fdata;
-        }
-
-        family = (*env)->CallObjectMethod(env, font, fontIDs.getFamily);
-
-        if (!awtJNI_FontName(env, family, &foundry, &name, &encoding)) {
-            if (errmsg != NULL) {
-                *errmsg = "java/lang" "NullPointerException";
-            }
-            (*env)->DeleteLocalRef(env, family);
-            return (struct FontData *) NULL;
-        }
-        style = Style((*env)->GetIntField(env, font, fontIDs.style));
-        oheight = height = (*env)->GetIntField(env, font, fontIDs.size);
-
-        while (1) {
-            jio_snprintf(fontSpec, sizeof(fontSpec), "-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
-                         foundry,
-                         name,
-                         style,
-                         height,
-                         encoding);
-
-            /*fprintf(stderr,"LoadFont: %s\n", fontSpec); */
-            xfont = XLoadQueryFont(display, fontSpec);
-
-            /* XXX: sometimes XLoadQueryFont returns a bogus font structure */
-            /* with negative ascent. */
-            if (xfont == NULL || xfont->ascent < 0) {
-                if (xfont != NULL) {
-                    XFreeFont(display, xfont);
-                }
-                if (foundry != anyfoundry) {  /* Use ptr comparison here, not strcmp */
-                    /* Try any other foundry before messing with the sizes */
-                    foundry = anyfoundry;
-                    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. */
-                if (above == below) {
-                    above++;
-                    height = oheight + above;
-                } else {
-                    below++;
-                    if (below > 4) {
-                        if (name != defaultfontname || style != anystyle) {
-                            name = defaultfontname;
-                            foundry = defaultfoundry;
-                            height = oheight;
-                            style = anystyle;
-                            encoding = isolatin1;
-                            above = below = 0;
-                            continue;
-                        } else {
-                            if (errmsg != NULL) {
-                                *errmsg = "java/io/" "FileNotFoundException";
-                            }
-                            (*env)->DeleteLocalRef(env, family);
-                            return (struct FontData *) NULL;
-                        }
-                    }
-                    height = oheight - below;
-                }
-                continue;
-            } else {
-                fdata = ZALLOC(FontData);
-
-                if (fdata == NULL) {
-                    if (errmsg != NULL) {
-                        *errmsg = "java/lang" "OutOfMemoryError";
-                    }
-                } else {
-                    fdata->xfont = xfont;
-                    JNU_SetLongFieldFromPtr(env,font,fontIDs.pData,fdata);
-                    Disposer_AddRecord(env, font, pDataDisposeMethod,
-                                       ptr_to_jlong(fdata));
-                }
-                (*env)->DeleteLocalRef(env, family);
-                return fdata;
-            }
-        }
-        /* not reached */
-    }
-}
-
 /*
  * Registered with the 2D disposer to be called after the Font is GC'd.
  */
--- a/src/java.desktop/unix/native/common/awt/awt_Font.h	Thu Jun 13 12:22:28 2019 +0530
+++ b/src/java.desktop/unix/native/common/awt/awt_Font.h	Sun Jun 09 18:14:48 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -34,11 +34,6 @@
     jmethodID getFamily;
 };
 
-/* fieldIDs for XFontPeer fields that may be accessed from C */
-struct XFontPeerIDs {
-    jfieldID xfsname;
-};
-
 /* fieldIDs for PlatformFont fields that may be accessed from C */
 struct PlatformFontIDs {
     jfieldID componentFonts;
--- a/src/java.desktop/unix/native/common/awt/awt_p.h	Thu Jun 13 12:22:28 2019 +0530
+++ b/src/java.desktop/unix/native/common/awt/awt_p.h	Sun Jun 09 18:14:48 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, 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
@@ -119,8 +119,6 @@
     XFontStruct *xfont; /* Latin1 font */
 };
 
-extern struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg);
-
 extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen);
 extern AwtScreenDataPtr getScreenData(int screen);
 #endif /* !HEADLESS */
--- a/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.c	Thu Jun 13 12:22:28 2019 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,393 +0,0 @@
-/*
- * Copyright (c) 1996, 2014, 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.  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.
- */
-
-/*
- * These routines are used for display string with multi font.
- */
-
-#ifdef HEADLESS
-    #error This file should not be included in headless library
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <ctype.h>
-#include <jni.h>
-#include <jni_util.h>
-#include <jvm.h>
-#include "awt_Font.h"
-#include "awt_p.h"
-#include "multi_font.h"
-
-extern XFontStruct *loadFont(Display *, char *, int32_t);
-
-extern struct FontIDs fontIDs;
-extern struct PlatformFontIDs platformFontIDs;
-extern struct XFontPeerIDs xFontPeerIDs;
-
-/*
- * make string with str + string representation of num
- * This string is used as tag string of Motif Compound String and FontList.
- */
-static void
-makeTag(char *str, int32_t num, char *buf)
-{
-    int32_t len = strlen(str);
-
-    strcpy(buf, str);
-    buf[len] = '0' + num % 100;
-    buf[len + 1] = '\0';
-}
-
-static int32_t
-awtJNI_GetFontDescriptorNumber(JNIEnv * env
-                               ,jobject font
-                               ,jobject fd)
-{
-    int32_t i = 0, num;
-    /* initialize to NULL so that DeleteLocalRef will work. */
-    jobjectArray componentFonts = NULL;
-    jobject peer = NULL;
-    jobject temp = NULL;
-    jboolean validRet = JNI_FALSE;
-
-    if ((*env)->EnsureLocalCapacity(env, 2) < 0 || (*env)->ExceptionCheck(env))
-        goto done;
-
-    peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
-    if (peer == NULL)
-        goto done;
-
-    componentFonts = (jobjectArray)
-        (*env)->GetObjectField(env,peer,platformFontIDs.componentFonts);
-
-    if (componentFonts == NULL)
-        goto done;
-
-    num = (*env)->GetArrayLength(env, componentFonts);
-
-    for (i = 0; i < num; i++) {
-        temp = (*env)->GetObjectArrayElement(env, componentFonts, i);
-
-        if ((*env)->IsSameObject(env, fd, temp)) {
-            validRet = JNI_TRUE;
-            break;
-        }
-        (*env)->DeleteLocalRef(env, temp);
-    }
-
- done:
-    (*env)->DeleteLocalRef(env, peer);
-    (*env)->DeleteLocalRef(env, componentFonts);
-
-    if (validRet)
-        return i;
-
-    return 0;
-}
-
-jobject
-awtJNI_GetFMFont(JNIEnv * env, jobject this)
-{
-    return JNU_CallMethodByName(env, NULL, this, "getFont_NoClientCode",
-                                "()Ljava/awt/Font;").l;
-}
-
-jboolean
-awtJNI_IsMultiFont(JNIEnv * env, jobject this)
-{
-    jobject peer = NULL;
-    jobject fontConfig = NULL;
-
-    if (this == NULL) {
-        return JNI_FALSE;
-    }
-
-    if ((*env)->EnsureLocalCapacity(env, 2) < 0) {
-        return JNI_FALSE;
-    }
-
-    peer = (*env)->CallObjectMethod(env,this,fontIDs.getPeer);
-    if (peer == NULL) {
-        return JNI_FALSE;
-    }
-
-    fontConfig = (*env)->GetObjectField(env,peer,platformFontIDs.fontConfig);
-    (*env)->DeleteLocalRef(env, peer);
-
-    if (fontConfig == NULL) {
-        return JNI_FALSE;
-    }
-    (*env)->DeleteLocalRef(env, fontConfig);
-
-    return JNI_TRUE;
-}
-
-jboolean
-awtJNI_IsMultiFontMetrics(JNIEnv * env, jobject this)
-{
-    jobject peer = NULL;
-    jobject fontConfig = NULL;
-    jobject font = NULL;
-
-    if (JNU_IsNull(env, this)) {
-        return JNI_FALSE;
-    }
-    if ((*env)->EnsureLocalCapacity(env, 3) < 0) {
-        return JNI_FALSE;
-    }
-
-    font = JNU_CallMethodByName(env, NULL, this, "getFont_NoClientCode",
-                                "()Ljava/awt/Font;").l;
-    if (JNU_IsNull(env, font) || (*env)->ExceptionCheck(env)) {
-        return JNI_FALSE;
-    }
-
-    peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
-    (*env)->DeleteLocalRef(env, font);
-
-    if (peer == NULL) {
-        return JNI_FALSE;
-    }
-
-    fontConfig = (*env)->GetObjectField(env,peer,platformFontIDs.fontConfig);
-    (*env)->DeleteLocalRef(env, peer);
-    if (fontConfig == NULL) {
-        return JNI_FALSE;
-    }
-    (*env)->DeleteLocalRef(env, fontConfig);
-
-    return JNI_TRUE;
-}
-
-/* #define FONT_DEBUG 2 */
-
-XFontSet
-awtJNI_MakeFontSet(JNIEnv * env, jobject font)
-{
-    jstring xlfd = NULL;
-    char *xfontset = NULL;
-    int32_t size;
-    int32_t length = 0;
-    char *realxlfd = NULL, *ptr = NULL, *prev = NULL;
-    char **missing_list = NULL;
-    int32_t missing_count;
-    char *def_string = NULL;
-    XFontSet xfs;
-    jobject peer = NULL;
-    jstring xfsname = NULL;
-#ifdef FONT_DEBUG
-    char xx[1024];
-#endif
-
-    if ((*env)->EnsureLocalCapacity(env, 2) < 0)
-        return 0;
-
-    size = (*env)->GetIntField(env, font, fontIDs.size) * 10;
-
-    peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
-    xfsname = (*env)->GetObjectField(env, peer, xFontPeerIDs.xfsname);
-
-    if (JNU_IsNull(env, xfsname))
-        xfontset = "";
-    else
-        xfontset = (char *)JNU_GetStringPlatformChars(env, xfsname, NULL);
-
-    realxlfd = malloc(strlen(xfontset) + 50);
-
-    prev = ptr = xfontset;
-    while ((ptr = strstr(ptr, "%d"))) {
-        char save = *(ptr + 2);
-
-        *(ptr + 2) = '\0';
-        jio_snprintf(realxlfd + length, strlen(xfontset) + 50 - length,
-                     prev, size);
-        length = strlen(realxlfd);
-        *(ptr + 2) = save;
-
-        prev = ptr + 2;
-        ptr += 2;
-    }
-    strcpy(realxlfd + length, prev);
-
-#ifdef FONT_DEBUG
-    strcpy(xx, realxlfd);
-#endif
-    xfs = XCreateFontSet(awt_display, realxlfd, &missing_list,
-                         &missing_count, &def_string);
-#if FONT_DEBUG >= 2
-    fprintf(stderr, "XCreateFontSet(%s)->0x%x\n", xx, xfs);
-#endif
-
-#if FONT_DEBUG
-    if (missing_count != 0) {
-        int32_t i;
-        fprintf(stderr, "XCreateFontSet missing %d fonts:\n", missing_count);
-        for (i = 0; i < missing_count; ++i) {
-            fprintf(stderr, "\t\"%s\"\n", missing_list[i]);
-        }
-        fprintf(stderr, "  requested \"%s\"\n", xx);
-#if FONT_DEBUG >= 3
-        exit(-1);
-#endif
-    }
-#endif
-
-    free((void *)realxlfd);
-
-    if (xfontset && !JNU_IsNull(env, xfsname))
-        JNU_ReleaseStringPlatformChars(env, xfsname, (const char *) xfontset);
-
-    (*env)->DeleteLocalRef(env, peer);
-    (*env)->DeleteLocalRef(env, xfsname);
-    return xfs;
-}
-
-/*
- * get multi font string width with multiple X11 font
- *
- * ASSUMES: We are not running on a privileged thread
- */
-int32_t
-awtJNI_GetMFStringWidth(JNIEnv * env, jcharArray s, int offset, int sLength, jobject font)
-{
-    char *err = NULL;
-    unsigned char *stringData = NULL;
-    char *offsetStringData = NULL;
-    int32_t stringCount, i;
-    int32_t size;
-    struct FontData *fdata = NULL;
-    jobject fontDescriptor = NULL;
-    jbyteArray data = NULL;
-    int32_t j;
-    int32_t width = 0;
-    int32_t length;
-    XFontStruct *xf = NULL;
-    jobjectArray dataArray = NULL;
-    if ((*env)->EnsureLocalCapacity(env, 3) < 0)
-        return 0;
-
-    if (!JNU_IsNull(env, s) && !JNU_IsNull(env, font))
-    {
-        jobject peer;
-        peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
-
-        dataArray = (*env)->CallObjectMethod(
-                                 env,
-                                 peer,
-                                 platformFontIDs.makeConvertedMultiFontChars,
-                                 s, offset, sLength);
-
-        if ((*env)->ExceptionOccurred(env))
-        {
-            (*env)->ExceptionDescribe(env);
-            (*env)->ExceptionClear(env);
-        }
-
-        (*env)->DeleteLocalRef(env, peer);
-
-        if(dataArray == NULL)
-        {
-            return 0;
-        }
-    } else {
-        return 0;
-    }
-
-    fdata = awtJNI_GetFontData(env, font, &err);
-    if ((*env)->ExceptionCheck(env)) {
-        (*env)->DeleteLocalRef(env, dataArray);
-        return 0;
-    }
-
-    stringCount = (*env)->GetArrayLength(env, dataArray);
-
-    size = (*env)->GetIntField(env, font, fontIDs.size);
-
-    for (i = 0; i < stringCount; i+=2)
-    {
-        fontDescriptor = (*env)->GetObjectArrayElement(env, dataArray, i);
-        data = (*env)->GetObjectArrayElement(env, dataArray, i + 1);
-
-        /* Bail if we've finished */
-        if (fontDescriptor == NULL || data == NULL) {
-            (*env)->DeleteLocalRef(env, fontDescriptor);
-            (*env)->DeleteLocalRef(env, data);
-            break;
-        }
-
-        j = awtJNI_GetFontDescriptorNumber(env, font, fontDescriptor);
-        if ((*env)->ExceptionCheck(env)) {
-            (*env)->DeleteLocalRef(env, fontDescriptor);
-            (*env)->DeleteLocalRef(env, data);
-            break;
-        }
-
-        if (fdata->flist[j].load == 0) {
-            xf = loadFont(awt_display,
-                          fdata->flist[j].xlfd, size * 10);
-            if (xf == NULL) {
-                (*env)->DeleteLocalRef(env, fontDescriptor);
-                (*env)->DeleteLocalRef(env, data);
-                continue;
-            }
-            fdata->flist[j].load = 1;
-            fdata->flist[j].xfont = xf;
-            if (xf->min_byte1 == 0 && xf->max_byte1 == 0)
-                fdata->flist[j].index_length = 1;
-            else
-                fdata->flist[j].index_length = 2;
-        }
-        xf = fdata->flist[j].xfont;
-
-        stringData =
-            (unsigned char *)(*env)->GetPrimitiveArrayCritical(env, data,NULL);
-        if (stringData == NULL) {
-            (*env)->DeleteLocalRef(env, fontDescriptor);
-            (*env)->DeleteLocalRef(env, data);
-            (*env)->ExceptionClear(env);
-            JNU_ThrowOutOfMemoryError(env, "Could not get string data");
-            break;
-        }
-
-        length = (stringData[0] << 24) | (stringData[1] << 16) |
-            (stringData[2] << 8) | stringData[3];
-        offsetStringData = (char *)(stringData + (4 * sizeof(char)));
-
-        if (fdata->flist[j].index_length == 2) {
-            width += XTextWidth16(xf, (XChar2b *)offsetStringData, length/2);
-        } else {
-            width += XTextWidth(xf, offsetStringData, length);
-        }
-
-        (*env)->ReleasePrimitiveArrayCritical(env, data, stringData, JNI_ABORT);
-        (*env)->DeleteLocalRef(env, fontDescriptor);
-        (*env)->DeleteLocalRef(env, data);
-    }
-    (*env)->DeleteLocalRef(env, dataArray);
-
-    return width;
-}
--- a/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.h	Thu Jun 13 12:22:28 2019 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1996, 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.  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.
- */
-/*
- * header for Multi Font String
- */
-#ifndef _MULTI_FONT_H_
-#define _MULTI_FONT_H_
-
-#ifndef HEADLESS
-jboolean awtJNI_IsMultiFont(JNIEnv *env,jobject this);
-jboolean awtJNI_IsMultiFontMetrics(JNIEnv *env,jobject this);
-XFontSet awtJNI_MakeFontSet(JNIEnv *env,jobject font);
-struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg);
-int32_t awtJNI_GetMFStringWidth(JNIEnv * env, jcharArray s, int32_t offset,
-                                int32_t length, jobject font);
-#endif /* !HEADLESS */
-
-#endif /* _MULTI_FONT_H_ */
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Thu Jun 13 12:22:28 2019 +0530
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Sun Jun 09 18:14:48 2019 -0700
@@ -79,16 +79,6 @@
 extern Display* awt_init_Display(JNIEnv *env, jobject this);
 extern void freeNativeStringArray(char **array, jsize length);
 extern char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length);
-
-struct XFontPeerIDs xFontPeerIDs;
-
-JNIEXPORT void JNICALL
-Java_sun_awt_X11_XFontPeer_initIDs
-  (JNIEnv *env, jclass cls)
-{
-    xFontPeerIDs.xfsname =
-      (*env)->GetFieldID(env, cls, "xfsname", "Ljava/lang/String;");
-}
 #endif /* !HEADLESS */
 
 /* This function gets called from the static initializer for FileDialog.java