Method from org.apache.fontbox.ttf.PostScriptTable Detail: |
public float getFormatType() {
return formatType;
}
|
public String[] getGlyphNames() {
return glyphNames;
}
|
public long getIsFixedPitch() {
return isFixedPitch;
}
|
public float getItalicAngle() {
return italicAngle;
}
|
public long getMaxMemType1() {
return maxMemType1;
}
|
public long getMaxMemType42() {
return maxMemType42;
}
|
public long getMimMemType1() {
return mimMemType1;
}
|
public long getMinMemType42() {
return minMemType42;
}
|
public short getUnderlinePosition() {
return underlinePosition;
}
|
public short getUnderlineThickness() {
return underlineThickness;
}
|
public void initData(TrueTypeFont ttf,
TTFDataStream data) throws IOException {
MaximumProfileTable maxp = ttf.getMaximumProfile();
formatType = data.read32Fixed();
italicAngle = data.read32Fixed();
underlinePosition = data.readSignedShort();
underlineThickness = data.readSignedShort();
isFixedPitch = data.readUnsignedInt();
minMemType42 = data.readUnsignedInt();
maxMemType42 = data.readUnsignedInt();
mimMemType1 = data.readUnsignedInt();
maxMemType1 = data.readUnsignedInt();
MacRomanEncoding encoding = new MacRomanEncoding();
if( formatType == 1.0f )
{
/*
* This TrueType font file contains exactly the 258 glyphs in the standard
* Macintosh TrueType.
*/
glyphNames = new String[258];
for( int i=0; i< glyphNames.length; i++)
{
String name = encoding.getName( i );
if( name != null )
{
glyphNames[i] = name;
}
}
}
else if( formatType == 2.0f )
{
int numGlyphs = data.readUnsignedShort();
int[] glyphNameIndex = new int[numGlyphs];
glyphNames = new String[ numGlyphs ];
int maxIndex = Integer.MIN_VALUE;
for( int i=0; i< numGlyphs; i++ )
{
int index = data.readUnsignedShort();
glyphNameIndex[i] = index;
maxIndex = Math.max( maxIndex, index );
}
String[] nameArray = null;
if( maxIndex >= 258 )
{
nameArray = new String[ maxIndex-258 +1 ];
for( int i=0; i< maxIndex-258+1; i++ )
{
int numberOfChars = data.read();
nameArray[i]=data.readString( numberOfChars );
}
}
for( int i=0; i< numGlyphs; i++ )
{
int index = glyphNameIndex[i];
if( index < 258 )
{
glyphNames[i] = encoding.getName( index );
}
else if( index >= 258 && index < = 32767 )
{
glyphNames[i] = nameArray[index-258];
}
else
{
throw new IOException( "Unknown glyph name index:" + index );
}
}
}
else if( formatType == 2.5f )
{
int[] glyphNameIndex = new int[maxp.getNumGlyphs()];
for( int i=0; i< glyphNameIndex.length; i++)
{
int offset = data.readSignedByte();
glyphNameIndex[i] = i+1+offset;
}
glyphNames = new String[glyphNameIndex.length];
for( int i=0; i< glyphNames.length; i++)
{
String name = encoding.getName( glyphNameIndex[i] );
if( name != null )
{
glyphNames[i] = name;
}
}
}
else if( formatType == 3.0f )
{
//no postscript information is provided.
}
}
This will read the required data from the stream. |
public void setFormatType(float formatTypeValue) {
this.formatType = formatTypeValue;
}
|
public void setGlyphNames(String[] glyphNamesValue) {
this.glyphNames = glyphNamesValue;
}
|
public void setIsFixedPitch(long isFixedPitchValue) {
this.isFixedPitch = isFixedPitchValue;
}
|
public void setItalicAngle(float italicAngleValue) {
this.italicAngle = italicAngleValue;
}
|
public void setMaxMemType1(long maxMemType1Value) {
this.maxMemType1 = maxMemType1Value;
}
|
public void setMaxMemType42(long maxMemType42Value) {
this.maxMemType42 = maxMemType42Value;
}
|
public void setMimMemType1(long mimMemType1Value) {
this.mimMemType1 = mimMemType1Value;
}
|
public void setMinMemType42(long minMemType42Value) {
this.minMemType42 = minMemType42Value;
}
|
public void setUnderlinePosition(short underlinePositionValue) {
this.underlinePosition = underlinePositionValue;
}
|
public void setUnderlineThickness(short underlineThicknessValue) {
this.underlineThickness = underlineThicknessValue;
}
|