Beispiel #1
0
void
VFont::Read ()
{
  if (! characterTable.empty() || dviInfo.notLoadable)
    {
      return;
    }

  dviInfo.notLoadable = true;

  InputStream stream (dviInfo.fileName.c_str());

  trace_vfont->WriteFormattedLine
    ("libdvi",
     T_("reading vf file %s"),
     Q_(dviInfo.fileName));

  if (stream.ReadByte() != pre)
    {
      FATAL_DVI_ERROR ("VFont::Read",
		       T_("Not a VF file."),
		       dviInfo.fileName.c_str());
    }

  ReadPreamble (stream);
  ReadFontDefsAndCharPackets (stream);
  ReadPostamble (stream);
  
  dviInfo.notLoadable = false;
}
Beispiel #2
0
FieldList
ReadHeader(char     **version,	/* version (output) */
	   int      *arch,	/* architecture (output) */
	   long     *pre_size,	/* preamble size  (output) */
	   long     *hdr_size,	/* header size (output) */
	   long     *rec_size,	/* record size (output) */
	   FILE     *file)	/* input file */
{
    FieldList	list;
    char	*architecture;

    if (!ReadPreamble(version,
		      &architecture, pre_size, hdr_size, rec_size, file))
	return NULL;	/* Bad preamble. */
    if (strcmp(architecture, EsignalArch) == 0)    /* native architecture */
    {
	if (arch != NULL)
	    *arch = NATIVE;

	if (!ReadNativeFieldList(&list, file))
	    return NULL;
    }
    else if (strcmp(architecture, "EDR1") == 0)
    {
	if (arch != NULL)
	    *arch = EDR1;

	/*
	 * On machines whose native architecture is EDR1, could call
	 * ReadNativeFieldList here.
	 */
	if (!ReadEdrFieldList(&list, file, EDR1))
	    return NULL;
    }
    else if (strcmp(architecture, "EDR2") == 0)
    {
	if (arch != NULL)
	    *arch = EDR2;
	/*
	 * On machines whose native architecture is EDR2, could call
	 * ReadNativeFieldList here.
	 */
	if (!ReadEdrFieldList(&list, file, EDR2))
	    return NULL;
    }
    else if (strcmp(architecture, "ASCII") == 0)
    {
	if (arch != NULL)
	    *arch = ASCII;

	if (!ReadAsciiFieldList(&list, file))
	    return NULL;
    }
    else
    {
	if (arch != NULL)
	    *arch = UNKNOWN;

	return NULL;		/* Unsupported architecture. */
    }

    return list;
}