8172967: [macosx] Exception while working with layout for text containing unmappable character
Reviewed-by: serb, psadhukhan
This commit is contained in:
parent
4248b4a35f
commit
6e97034144
@ -71,7 +71,9 @@ public final class CompositeStrike extends FontStrike {
|
||||
}
|
||||
|
||||
PhysicalStrike getStrikeForSlot(int slot) {
|
||||
|
||||
if (slot >= strikes.length) {
|
||||
slot = 0;
|
||||
}
|
||||
PhysicalStrike strike = strikes[slot];
|
||||
if (strike == null) {
|
||||
strike =
|
||||
|
@ -626,7 +626,11 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
|
||||
glyphinfo = gv.getGlyphInfo();
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println(source);
|
||||
if (DEBUG) {
|
||||
System.err.println(source);
|
||||
e.printStackTrace();
|
||||
}
|
||||
glyphinfo = new float[gv.getNumGlyphs() * numvals];
|
||||
}
|
||||
|
||||
int numGlyphs = gv.getNumGlyphs();
|
||||
|
@ -52,6 +52,9 @@ hb_jdk_get_glyph (hb_font_t *font HB_UNUSED,
|
||||
|
||||
*glyph = (hb_codepoint_t)
|
||||
env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, u);
|
||||
if ((int)*glyph < 0) {
|
||||
*glyph = 0;
|
||||
}
|
||||
return (*glyph != 0);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @summary Verify no exception for unsupported code point.
|
||||
* @bug 8172967
|
||||
*/
|
||||
import java.awt.Font;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.TextLayout;
|
||||
|
||||
public class MissingCodePointLayoutTest {
|
||||
public static void main(String[] args) {
|
||||
Font font = new Font("Tahoma", Font.PLAIN, 12);
|
||||
String text = "\ude00";
|
||||
FontRenderContext frc = new FontRenderContext(null, false, false);
|
||||
TextLayout layout = new TextLayout(text, font, frc);
|
||||
layout.getCaretShapes(0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user