void PostScriptView::ConstProcs (ostream& out) { UList* fonts = GetPSFonts(); int nfonts = Count(fonts); out << "/IdrawDict " << (50 + nfonts) << " dict def\n"; out << "IdrawDict begin\n\n"; if (nfonts > 0) { for (const char** line = reencodeISO; *line != nil; ++line) { out << *line << "\n"; } for (UList* u = fonts->First(); u != fonts->End(); u = u->Next()) { PSFont* font = GetFont(u); // No way to check if the X font's encoding is iso8859-1, so... if (strncmp(font->GetPrintFont(), "Symbol", 6) != 0) { out << "/" << font->GetPrintFont() << " reencodeISO def\n"; } else { out << "/" << font->GetPrintFont() << " dup findfont def\n"; } } out << "\n"; } out << "/none null def\n"; out << "/numGraphicParameters 17 def\n"; out << "/stringLimit 65535 def\n\n"; }
UHashElem* UHashTable::Find (void* key) { int n = Hash(key); UList* slot = _slot[n]; if (slot != nil) { for (UList* u = slot->First(); u != slot->End(); u = u->Next()) { UHashElem* elem = Elem(u); if (Equal(elem->GetKey(), key)) { return elem; } } } return nil; }
void PostScriptView::FontNames (ostream& out) { UList* fonts = GetPSFonts(); const char* comment = "%%DocumentFonts:"; int linelen = strlen(comment); out << comment; for (UList* u = fonts->First(); u != fonts->End(); u = u->Next()) { PSFont* font = GetFont(u); if (linelen + strlen(font->GetPrintFont()) + 2 <= MAXLINELEN) { out << " "; ++linelen; } else { out << "\n%%+ "; linelen = strlen("%%+ "); } out << font->GetPrintFont(); linelen += strlen(font->GetPrintFont()); } out << "\n"; }
void UHashTable::Unregister (void* key) { int n = Hash(key); UList* slot = _slot[n]; if (slot != nil) { for (UList* u = slot->First(); u != slot->End(); u = u->Next()) { UHashElem* elem = Elem(u); if (Equal(elem->GetKey(), key)) { slot->Remove(u); delete elem; delete u; if (_slot[n]->IsEmpty()) { delete _slot[n]; _slot[n] = nil; } break; } } } }