// Unable to decode the Text without Font
registerError("Text operator can't be process without Font", ERROR_FONTS_UNKNOWN_FONT_REF);
return;
}
FontContainer fontContainer = context.getFontContainer(font.getCOSObject());
if (renderingMode == 3 && (fontContainer == null || !fontContainer.isEmbeddedFont()))
{
// font not embedded and rendering mode is 3. Valid case and nothing to check
return;
}
else if (fontContainer == null)
{
// Font Must be embedded if the RenderingMode isn't 3
registerError(font.getBaseFont() + " is unknown wasn't found by the FontHelperValdiator",
ERROR_FONTS_UNKNOWN_FONT_REF);
return;
}
else if (!fontContainer.isValid() && !fontContainer.errorsAleadyMerged())
{
context.addValidationErrors(fontContainer.getAllErrors());
fontContainer.setErrorsAleadyMerged(true);
return;
}
if (!fontContainer.isValid() && fontContainer.errorsAleadyMerged())
{
// font already computed
return;
}
int codeLength = 1;
for (int i = 0; i < string.length; i += codeLength)
{
// explore the string to detect character code (length can be 1 or 2 bytes)
int cid = -1;
codeLength = 1;
try
{
// according to the encoding, extract the character identifier
cid = font.encodeToCID(string, i, codeLength);
if (cid == -1 && i + 1 < string.length)
{
// maybe a multibyte encoding
codeLength++;
cid = font.encodeToCID(string, i, codeLength);
}
fontContainer.checkGlyphWith(cid);
}
catch (IOException e)
{
registerError("Encoding can't interpret the character code", ERROR_FONTS_ENCODING_ERROR);
return;