org.foray.font.output
Class FontPdf4a

java.lang.Object
  extended by org.foray.font.output.FontOutput4a
      extended by org.foray.font.output.FontPdf4a
All Implemented Interfaces:
org.axsl.font.output.FontOutput, org.axsl.font.output.FontPdf

public class FontPdf4a
extends FontOutput4a
implements org.axsl.font.output.FontPdf

Helper class for applications using or embedding fonts in PDF output.


Field Summary
static byte FLAG_BIT_ALL_CAP
          Font Descriptor Flag bit for "AllCap".
static byte FLAG_BIT_FIXED_PITCH
          Font Descriptor Flag bit for "FixedPitch".
static byte FLAG_BIT_FORCE_BOLD
          Font Descriptor Flag bit for "ForceBold".
static byte FLAG_BIT_ITALIC
          Font Descriptor Flag bit for "Italic".
static byte FLAG_BIT_NONSYMBOLIC
          Font Descriptor Flag bit for "Nonsymbolic".
static byte FLAG_BIT_SCRIPT
          Font Descriptor Flag bit for "Script".
static byte FLAG_BIT_SERIF
          Font Descriptor Flag bit for "Serif".
static byte FLAG_BIT_SMALL_CAP
          Font Descriptor Flag bit for "SmallCap".
static byte FLAG_BIT_SYMBOLIC
          Font Descriptor Flag bit for "Symbolic".
 
Constructor Summary
FontPdf4a(FontUse4a fontUse)
          Constructor.
 
Method Summary
 int getFlags()
           
 int[] getFontBoundingBox()
           
 String getItalicAngleFormatted()
          Returns a compactly formatted version of the ItalicAngle value for this font, expressed in degrees counterclockwise from vertical.
 String getPdfFontFileStreamAdditional()
          Returns the "Additional entries in a FontFile stream dictionary" that is documented in the PDF Reference, Second Edition, Section 5.8, especially Table 5.22.
 int getPDFFontFileStreamSize()
          Returns the size, in bytes, of the output stream.
 String getToUnicodeBf()
           
 String getUnicodeString(int c)
          Convert a char to a multibyte hex representation.
static String padHexString(String input, int numChars)
          Prepends the input string with a sufficient number of "0" characters to get the returned string to be numChars length.
 String textToPdf(CharSequence theString, org.axsl.font.FontOptions fontOptions, org.axsl.common.i18n.Orthography orthography)
           
protected  void writeBFCharEntries(StringBuilder p, char[] charArray)
          Writes the BFChar entries.
protected  void writeBFRangeEntries(StringBuilder p, char[] charArray)
          Writes the BFChar range entries.
 
Methods inherited from class org.foray.font.output.FontOutput4a
getCharsUsed, getContents, getFirstIndex, getFontConsumer, getFontUse, getFOrayFont, getFOrayFontUse, getFreeStandingFont, getLastIndex, getLogger, getWidths
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axsl.font.output.FontPdf
getFirstIndex, getLastIndex, getWidths
 
Methods inherited from interface org.axsl.font.output.FontOutput
getContents, getFontUse
 

Field Detail

FLAG_BIT_FIXED_PITCH

public static final byte FLAG_BIT_FIXED_PITCH
Font Descriptor Flag bit for "FixedPitch". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_SERIF

public static final byte FLAG_BIT_SERIF
Font Descriptor Flag bit for "Serif". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_SYMBOLIC

public static final byte FLAG_BIT_SYMBOLIC
Font Descriptor Flag bit for "Symbolic". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_SCRIPT

public static final byte FLAG_BIT_SCRIPT
Font Descriptor Flag bit for "Script". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_NONSYMBOLIC

public static final byte FLAG_BIT_NONSYMBOLIC
Font Descriptor Flag bit for "Nonsymbolic". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_ITALIC

public static final byte FLAG_BIT_ITALIC
Font Descriptor Flag bit for "Italic". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_ALL_CAP

public static final byte FLAG_BIT_ALL_CAP
Font Descriptor Flag bit for "AllCap". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_SMALL_CAP

public static final byte FLAG_BIT_SMALL_CAP
Font Descriptor Flag bit for "SmallCap". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values

FLAG_BIT_FORCE_BOLD

public static final byte FLAG_BIT_FORCE_BOLD
Font Descriptor Flag bit for "ForceBold". See PDFRM, 3rd, 5.7.1.

See Also:
Constant Field Values
Constructor Detail

FontPdf4a

public FontPdf4a(FontUse4a fontUse)
Constructor.

Parameters:
fontUse - The FontUse4a instance for which this output helper is created.
Method Detail

getPdfFontFileStreamAdditional

public String getPdfFontFileStreamAdditional()
Returns the "Additional entries in a FontFile stream dictionary" that is documented in the PDF Reference, Second Edition, Section 5.8, especially Table 5.22.

Specified by:
getPdfFontFileStreamAdditional in interface org.axsl.font.output.FontPdf
Returns:
The String containing the "Additional entries".

getPDFFontFileStreamSize

public int getPDFFontFileStreamSize()
Returns the size, in bytes, of the output stream.

Returns:
The size of the output stream.

getFontBoundingBox

public int[] getFontBoundingBox()
Specified by:
getFontBoundingBox in interface org.axsl.font.output.FontPdf

getFlags

public int getFlags()
Specified by:
getFlags in interface org.axsl.font.output.FontPdf

getItalicAngleFormatted

public String getItalicAngleFormatted()
Returns a compactly formatted version of the ItalicAngle value for this font, expressed in degrees counterclockwise from vertical. Leading and trailing zeros are stripped. The decimal point is stripped for integral values. A leading negative sign is added for negative values, the lack of one indicates a positive value.

Specified by:
getItalicAngleFormatted in interface org.axsl.font.output.FontPdf
Returns:
The italic angle, formatted.

getToUnicodeBf

public String getToUnicodeBf()
Specified by:
getToUnicodeBf in interface org.axsl.font.output.FontPdf

writeBFCharEntries

protected void writeBFCharEntries(StringBuilder p,
                                  char[] charArray)
Writes the BFChar entries.

Parameters:
p - The buffer to which the entries should be written.
charArray - The chars which should be written.

writeBFRangeEntries

protected void writeBFRangeEntries(StringBuilder p,
                                   char[] charArray)
Writes the BFChar range entries.

Parameters:
p - The buffer to which the entries should be written.
charArray - The chars which should be written.

padHexString

public static String padHexString(String input,
                                  int numChars)
Prepends the input string with a sufficient number of "0" characters to get the returned string to be numChars length.

Parameters:
input - The input string.
numChars - The minimum characters in the output string.
Returns:
The padded string.

textToPdf

public String textToPdf(CharSequence theString,
                        org.axsl.font.FontOptions fontOptions,
                        org.axsl.common.i18n.Orthography orthography)
Specified by:
textToPdf in interface org.axsl.font.output.FontPdf

getUnicodeString

public String getUnicodeString(int c)
Convert a char to a multibyte hex representation.

Parameters:
c - The character to be converted.
Returns:
The string representation of the character.


Copyright © 2017. All rights reserved.