private static CffSubPosition[] LoadSubIndex(FontParser parser) { // How many are in here? int count = parser.ReadUInt16(); if (count == 0) { return(null); } // Create the offset set: int[] offsets = new int[count + 1]; // Read the offset size: int offsetSize = parser.ReadByte(); // Read each offset: for (int i = 0; i <= count; i++) { // Read the current offset: offsets[i] = parser.ReadOffset(offsetSize); } // Minus one as their not zero based: int objectOffset = parser.Position - 1; // Seek over the table: parser.Position = objectOffset + offsets[count]; // Create the result set: CffSubPosition[] results = new CffSubPosition[offsets.Length - 1]; // For each one.. for (int i = 0; i < results.Length; i++) { // Get the (relative) indices: int startIndex = offsets[i]; int length = offsets[i + 1] - startIndex; // Load the glyph now, which starts at startIndex+objectOffset: results[i] = new CffSubPosition(startIndex + objectOffset, length); } return(results); }
private static CffSubPosition[] LoadSubIndex(FontParser parser){ // How many are in here? int count=parser.ReadUInt16(); if(count==0){ return null; } // Create the offset set: int[] offsets=new int[count+1]; // Read the offset size: int offsetSize=parser.ReadByte(); // Read each offset: for(int i=0;i<=count;i++){ // Read the current offset: offsets[i]=parser.ReadOffset(offsetSize); } // Minus one as their not zero based: int objectOffset=parser.Position-1; // Seek over the table: parser.Position=objectOffset+offsets[count]; // Create the result set: CffSubPosition[] results=new CffSubPosition[offsets.Length-1]; // For each one.. for(int i=0;i<results.Length;i++){ // Get the (relative) indices: int startIndex=offsets[i]; int length=offsets[i+1]-startIndex; // Load the glyph now, which starts at startIndex+objectOffset: results[i]=new CffSubPosition(startIndex+objectOffset,length); } return results; }
public static int GetBias(CffSubPosition[] set){ if(set==null || set.Length<1240){ return 107; }else if(set.Length<33900){ return 1131; } return 32768; }