Beispiel #1
0
void PictSelection::WriteComments (ostream& to) {
    to << "%!PS-Adobe-2.0 EPSF-1.2\n";

    to << "%%DocumentFonts:";
    int linelen = strlen("%%DocumentFonts:");
    const int MAXLINELEN = 256;
    IFontList* fontlist = new IFontList;
    CollectFonts(fontlist);
    for (fontlist->First(); !fontlist->AtEnd(); fontlist->Next()) {
	IFont* font = fontlist->GetCur()->GetFont();
	if (linelen + strlen(font->GetPrintFont()) + 2 <= MAXLINELEN) {
	    to << " ";
	    ++linelen;
	} else {
	    to << "\n%%+ ";
	    linelen = strlen("%%+ ");
	}
	to << font->GetPrintFont();
	linelen += strlen(font->GetPrintFont());
    }
    to << "\n";
    delete fontlist;

    to << "%%Pages: 1\n";

    Coord l, b, r, t;
    GetBox(l, b, r, t);
    to << "%%BoundingBox: " << l << " " << b << " " << r << " " << t << "\n";

    to << "%%EndComments\n\n";
    to << "50 dict begin\n\n";
}
Beispiel #2
0
void PictSelection::Merge (IFont* font, IFontList* fontlist) {
    boolean found = false;
    if (font == nil) {
	found = true;
    } else if (fontlist->Find(font)) {
	found = true;
    } else {
	for (fontlist->First(); !fontlist->AtEnd(); fontlist->Next()) {
	    IFont* cmp = fontlist->GetCur()->GetFont();
	    if (strcmp(font->GetPrintFont(), cmp->GetPrintFont()) == 0) {
		found = true;
		break;
	    }
	}
    }
    if (!found) {
	fontlist->Append(new IFontNode(font));
    }
}