/** * Returns the width of the given Unicode string. * * @param text The text to get the width of. * @return The width of the string in 1/1000 units of text space. * @throws IOException If there is an error getting the width information. */ public float getStringWidth(String text) throws IOException { byte[] bytes = encode(text); ByteArrayInputStream in = new ByteArrayInputStream(bytes); float width = 0; while (in.available() > 0) { int code = readCode(in); width += getWidth(code); } return width; }
int code = font.readCode(in); int codeLength = before - in.available(); String unicode = font.toUnicode(code);
int code = font.readCode(in); fontContainer.checkGlyphWidth(code);
/** * Returns the width of the given Unicode string. * * @param text The text to get the width of. * @return The width of the string in 1/1000 units of text space. * @throws IOException If there is an error getting the width information. */ public float getStringWidth(String text) throws IOException { byte[] bytes = encode(text); ByteArrayInputStream in = new ByteArrayInputStream(bytes); float width = 0; while (in.available() > 0) { int code = readCode(in); width += getWidth(code); } return width; }
/** * Returns the width of the given Unicode string. * * @param text The text to get the width of. * @return The width of the string in 1/1000 units of text space. * @throws IOException If there is an error getting the width information. */ public float getStringWidth(String text) throws IOException { byte[] bytes = encode(text); ByteArrayInputStream in = new ByteArrayInputStream(bytes); float width = 0; while (in.available() > 0) { int code = readCode(in); width += getWidth(code); } return width; }
try (InputStream inputStream = new ByteArrayInputStream(string)) { while (inputStream.available() > 0) { int code = font.readCode(inputStream); Boolean glyphPresent = null; Boolean widthsConsistent = null ;
int code = font.readCode(in); int codeLength = before - in.available(); String unicode = font.toUnicode(code);
int code = font.readCode(in); int codeLength = before - in.available(); String unicode = font.toUnicode(code);
int code = font.readCode(in); fontContainer.checkGlyphWidth(code);
int code = font.readCode(in); fontContainer.checkGlyphWidth(code);