What is the difference between embeddable font and nonembedd font?

In the book I see an example:

BaseFont bf = BaseFont.createFont("KozMinPro-Regular", "Identity-V", BaseFont.NOT_EMBEDDED);
Font font = new Font(bf, 20);
VerticalText vt = new VerticalText(writer.getDirectContent()); vt.setVerticalLayout(390, 570, 540, 12, 30);
font = new Font(bf, 20);
vt.addText(new Phrase(convertCIDs("a"), font));
vt.go();

public String convertCIDs(String text) {
  char cid[] = text.toCharArray();
  for (int k = 0; k < cid.length; ++k) {
  char c = cid[k];
  if (c == '\n')
    cid[k] = '\uff00';
  else
    cid[k] = (char) (c - ' ' + 8720);
  }
  return new String(cid);
}

when i change to:

BaseFont bf = BaseFont.createFont("/../KozMinProRegular.otf",BaseFont.IDENTITY_V, BaseFont.EMBEDDED);

Result: “a” does not rotate 90 degrees clockwise.

+2
source share
1 answer

When the font is not embedded, the PDF viewer does not know what the font looks like. Instead of using the actual font, he searches for a font with a similar name in the operating system of the person viewing the document.

For example: there are 14 so-called Standard Type 1 fonts that do not need to be inserted:

  • Zapfdingbats
  • romancesque
  • fold-down
  • Helvetica-boldoblique
  • courier boldoblique
  • Helvetica font
  • Helvetica
  • inclined courier
  • Helvetica Inclined
  • Bold Courier
  • Fold-BoldItalic
  • courier
  • -

iText, iText embedded, , Adobe Reader .

, , Coca Cola, , Coca Cola, , , Walt Disney, , Walt Disney. . , , , PDF-.

, PDF. , . : PDF/A, .

CJK (, itext-asian.jar) iText embedded. CJK, CJK ( , Adobe Reader ).

IDENTITY_H IDENTITY_V iText embedded, PDF , encoding.

, , 90 embedded. , . IDENTITY_V . . , . . , , , . IDENTITY_V, , 90 , , ( IDENTITY_H ).

. vertical_text_1.pdf , V. , :

/**
 * Converts the CIDs of the horizontal characters of a String
 * into a String with vertical characters.
 * @param text The String with the horizontal characters
 * @return A String with vertical characters
 */
public String convertCIDs(String text) {
    char cid[] = text.toCharArray();
    for (int k = 0; k < cid.length; ++k) {
        char c = cid[k];
        if (c == '\n')
            cid[k] = '\uff00';
        else
            cid[k] = (char) (c - ' ' + 8720);
    }
    return new String(cid);
}

: vertical_text_2.pdf ( , ). .

+3

Source: https://habr.com/ru/post/1652089/


All Articles