#include <cpagefonts.h>
Public Types | |
| typedef std::list< std::string > | SystemFontList |
| typedef std::vector< std::pair < std::string, std::string > > | FontList |
Public Member Functions | |
| CPageFonts (CPage *page) | |
| ~CPageFonts () | |
| void | getFontIdsAndNames (FontList &cont) const |
| std::string | addSystemType1Font (const std::string &fontname, bool winansienc=true) |
Static Public Member Functions | |
| static SystemFontList | getSystemFonts () |
Private Attributes | |
| CPage * | _page |
Static Private Attributes | |
| static const char * | PDFEDIT_FONTID = "PDFEDIT_F" |
Class representing page fonts.
| typedef std::vector<std::pair<std::string, std::string> > pdfobjects::CPageFonts::FontList |
Type for list of fonts.
| typedef std::list<std::string> pdfobjects::CPageFonts::SystemFontList |
| pdfobjects::CPageFonts::CPageFonts | ( | CPage * | page | ) | [inline] |
| pdfobjects::CPageFonts::~CPageFonts | ( | ) | [inline] |
References _page.
| std::string pdfobjects::CPageFonts::addSystemType1Font | ( | const std::string & | fontname, | |
| bool | winansienc = true | |||
| ) |
Add new simple type 1 font item to the page resource dictionary.
The id of this font is arbitrary but it has to be unique. It will be generated as PDFEDIT_F#, where # is the lowest free number so that name is unique.
We supposed that the font name is a standard system font avaliable to all viewers.
| fontname | Name of the font to add. | |
| winansienc | Set encoding to standard WinAnsiEnconding. |
References _page, pdfobjects::CPageAttributes::InheritedAttributes::_resources, pdfobjects::Specification::Font::BASEFONT, pdfobjects::CPage::display(), pdfobjects::Specification::Font::ENCODING, pdfobjects::CPageAttributes::fillInherited(), pdfobjects::getCDictFromDict(), pdfobjects::CPage::getContentStreams(), pdfobjects::CPage::getDictionary(), getFontIdsAndNames(), PDFEDIT_FONTID, pdfobjects::Specification::Page::RESOURCES, pdfobjects::Specification::Font::SUBTYPE, pdfobjects::Specification::Dict::TYPE, pdfobjects::Specification::Font::TYPE, pdfobjects::Specification::Font::TYPE1, and pdfobjects::Specification::Font::WINANSIENCODING.
| void pdfobjects::CPageFonts::getFontIdsAndNames | ( | FontList & | cont | ) | const |
Get all font ids and base names that are in the resource dictionary of a page.
The resource can be inherited from a parent in the page tree dictionary. Base names should be human readable or at least standard system fonts defined in the pdf specification. We must choose from these items to make a font change valid. Otherwise, we have to add standard system font or manually a font object.
| cont | Output container of font id and basename pairs (FontList container type should be prefered). |
References _page, pdfobjects::CPageAttributes::InheritedAttributes::_resources, pdfobjects::Specification::Font::BASEFONT, debug::DBG_INFO, pdfobjects::CPageAttributes::fillInherited(), pdfobjects::getCDictFromDict(), pdfobjects::CPage::getDictionary(), pdfobjects::utils::getNameFromDict(), kernelPrintDbg, pdfobjects::Specification::Font::SUBTYPE, and pdfobjects::Specification::Font::TYPE.
Referenced by addSystemType1Font().
| static SystemFontList pdfobjects::CPageFonts::getSystemFonts | ( | ) | [inline, static] |
Get all system fonts which should be supported by all pdf viewers.
CPage* pdfobjects::CPageFonts::_page [private] |
Pdf dictionary representing a page.
Referenced by addSystemType1Font(), getFontIdsAndNames(), and ~CPageFonts().
const char * pdfobjects::CPageFonts::PDFEDIT_FONTID = "PDFEDIT_F" [static, private] |
Referenced by addSystemType1Font().