コード例 #1
0
ファイル: FastFont.cs プロジェクト: Jackjet/ECOSingle
 internal static void Register(PDF pdf, Font font, Stream inputStream)
 {
     font.name               = DejaVuLGCSerif.name;
     font.unitsPerEm         = DejaVuLGCSerif.unitsPerEm;
     font.bBoxLLx            = (float)DejaVuLGCSerif.bBoxLLx;
     font.bBoxLLy            = (float)DejaVuLGCSerif.bBoxLLy;
     font.bBoxURx            = (float)DejaVuLGCSerif.bBoxURx;
     font.bBoxURy            = (float)DejaVuLGCSerif.bBoxURy;
     font.ascent             = (float)DejaVuLGCSerif.ascent;
     font.descent            = (float)DejaVuLGCSerif.descent;
     font.capHeight          = (float)DejaVuLGCSerif.capHeight;
     font.firstChar          = DejaVuLGCSerif.firstChar;
     font.lastChar           = DejaVuLGCSerif.lastChar;
     font.underlinePosition  = (float)DejaVuLGCSerif.underlinePosition;
     font.underlineThickness = (float)DejaVuLGCSerif.underlineThickness;
     font.compressed_size    = DejaVuLGCSerif.compressed_size;
     font.uncompressed_size  = DejaVuLGCSerif.uncompressed_size;
     font.advanceWidth       = FastFont.DecodeRLE(DejaVuLGCSerif.advanceWidth);
     font.glyphWidth         = FastFont.DecodeRLE(DejaVuLGCSerif.glyphWidth);
     font.unicodeToGID       = FastFont.DecodeRLE(DejaVuLGCSerif.unicodeToGID);
     FastFont.EmbedFontFile(pdf, font, inputStream);
     FastFont.AddFontDescriptorObject(pdf, font);
     FastFont.AddCIDFontDictionaryObject(pdf, font);
     FastFont.AddToUnicodeCMapObject(pdf, font);
     pdf.Newobj();
     pdf.Append("<<\n");
     pdf.Append("/Type /Font\n");
     pdf.Append("/Subtype /Type0\n");
     pdf.Append("/BaseFont /");
     pdf.Append(font.name);
     pdf.Append('\n');
     pdf.Append("/Encoding /Identity-H\n");
     pdf.Append("/DescendantFonts [");
     pdf.Append(font.GetCidFontDictObjNumber());
     pdf.Append(" 0 R]\n");
     pdf.Append("/ToUnicode ");
     pdf.Append(font.GetToUnicodeCMapObjNumber());
     pdf.Append(" 0 R\n");
     pdf.Append(">>\n");
     pdf.Endobj();
     font.objNumber = pdf.objNumber;
 }