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"; }
UList* PostScriptView::GetPSFonts () { if (_fonts == nil) { _fonts = new UList; CollectFonts(GetGraphicComp(), _fonts); } return _fonts; }
// Set the universal_id member of each font to be unique among all // instances of the same font loaded. void Tesseract::SetupUniversalFontIds() { // Note that we can get away with bitwise copying FontInfo in // all_fonts, as it is a temporary structure and we avoid setting the // delete callback. UnicityTable<FontInfo> all_fonts; all_fonts.set_compare_callback(NewPermanentTessCallback(CompareFontInfo)); // Create the universal ID table. CollectFonts(get_fontinfo_table(), &all_fonts); for (int i = 0; i < sub_langs_.size(); ++i) { CollectFonts(sub_langs_[i]->get_fontinfo_table(), &all_fonts); } // Assign ids from the table to each font table. AssignIds(all_fonts, &get_fontinfo_table()); for (int i = 0; i < sub_langs_.size(); ++i) { AssignIds(all_fonts, &sub_langs_[i]->get_fontinfo_table()); } font_table_size_ = all_fonts.size(); }
static void CollectFonts (GraphicComp* comp, UList* fonts) { PSFont* font = comp->GetGraphic()->GetFont(); if (font != nil && Uncollected(font->GetPrintFont(), fonts)) { fonts->Append(new UList(font)); } Iterator i; for (comp->First(i); !comp->Done(i); comp->Next(i)) { CollectFonts(comp->GetComp(i), fonts); } }