void VFont::ReadFontDef (/*[in]*/ InputStream & inputStream, /*[in]*/ short fntDefX) { int fontNum; switch (fntDefX) { case fnt_def1: fontNum = inputStream.ReadByte(); break; case fnt_def2: fontNum = inputStream.ReadPair(); break; case fnt_def3: fontNum = inputStream.ReadTrio(); break; case fnt_def4: fontNum = inputStream.ReadSignedQuad(); break; default: FATAL_DVI_ERROR ("VFont::ReadFontDef", T_("Bad VF file."), dviInfo.fileName.c_str()); break; } trace_vfont->WriteFormattedLine ("libdvi", T_("defining font %d"), fontNum); int cs = inputStream.ReadSignedQuad(); int ss = inputStream.ReadSignedQuad(); int ds = inputStream.ReadSignedQuad(); int areaNameSize = inputStream.ReadByte(); int fontNameSize = inputStream.ReadByte(); char szArea[256]; inputStream.Read (szArea, areaNameSize); szArea[areaNameSize] = 0; char szName[256]; inputStream.Read (szName, fontNameSize); szName[fontNameSize] = 0; trace_vfont->WriteFormattedLine ("libdvi", "areaname: %s", szArea); trace_vfont->WriteFormattedLine ("libdvi", "fontname: %s", szName); trace_vfont->WriteFormattedLine ("libdvi", "checkSum: 0%o", cs); trace_vfont->WriteFormattedLine ("libdvi", "scaledSize: %d", ss); trace_vfont->WriteFormattedLine ("libdvi", "designSize: %d", ds); DviFont * pFont; PathName fileName; if (SessionWrapper(true)->FindFile(szName, FileType::VF, fileName)) { trace_vfont->WriteFormattedLine ("libdvi", T_("found vf file %s"), Q_(fileName)); pFont = new VFont (pDviImpl, cs, ScaleFix(ss, scaledAt), static_cast<int>(ds * tfmConv), szArea, szName, fileName.Get(), tfmConv, conv, mag, metafontMode.c_str(), baseDpi); } else if (pDviImpl->GetPageMode() != DviPageMode::Dvips) { pFont = new PkFont (pDviImpl, cs, ScaleFix(ss, scaledAt), static_cast<int>(ds * tfmConv), szArea, szName, "", tfmConv, conv, mag, metafontMode.c_str(), baseDpi); } else { pFont = new Tfm (pDviImpl, cs, ScaleFix(ss, scaledAt), static_cast<int>(ds * tfmConv), szArea, szName, "", tfmConv, conv); } fontMap[fontNum] = pFont; }
void PkChar::Read (/*[in]*/ InputStream & inputstream, /*[in]*/ int flag) { this->flag = flag; if (IsShort()) { // read character preamble (short form) packetSize = (((static_cast<int>(GetLower3()) % 4) << 8 | inputstream.ReadByte()) - 8); charCode = inputstream.ReadByte(); tfm = inputstream.ReadTrio(); cx = inputstream.ReadByte(); rasterWidth = inputstream.ReadByte(); rasterHeight = inputstream.ReadByte(); cxOffset = inputstream.ReadSignedByte(); cyOffset = inputstream.ReadSignedByte(); } else if (IsExtendedShort()) { // read character preamble (extended short form) packetSize = (((static_cast<int>(GetLower3()) % 4) << 16 | inputstream.ReadPair()) - 13); charCode = inputstream.ReadByte(); tfm = inputstream.ReadTrio(); cx = inputstream.ReadPair(); rasterWidth = inputstream.ReadPair(); rasterHeight = inputstream.ReadPair(); cxOffset = inputstream.ReadSignedPair(); cyOffset = inputstream.ReadSignedPair(); } else { // read character preamble (long form) packetSize = inputstream.ReadSignedQuad() - 28; charCode = inputstream.ReadSignedQuad(); tfm = inputstream.ReadSignedQuad(); cx = inputstream.ReadSignedQuad(); cx = (cx + 0x10000) >> 16; cy = inputstream.ReadSignedQuad(); cy = (cy + 0x10000) >> 16; rasterWidth = inputstream.ReadSignedQuad(); rasterHeight = inputstream.ReadSignedQuad(); cxOffset = inputstream.ReadSignedQuad(); cyOffset = inputstream.ReadSignedQuad(); } tfm = ScaleFix(tfm, pDviFont->GetScaledAt()); if (packetSize == 0) { #if 0 trace_error->WriteFormattedLine ("libdvi", T_("%d: no glyph!"), charCode); #endif } else { trace_pkchar->WriteFormattedLine ("libdvi", T_("going to read character %d"), charCode); pPackedRaster = new BYTE[packetSize]; inputstream.Read (pPackedRaster, packetSize); } }