Optimize selecting font in generated PostScript code

Emit code to select PostScript font only if it is needed (not at every call to SetFont(), but only if font has been really changed prior to a text drawing operation).
This commit is contained in:
Artur Wieczorek
2017-03-04 18:54:44 +01:00
parent 8950ac9a3f
commit feee67e6a1
3 changed files with 56 additions and 34 deletions

View File

@@ -139,6 +139,8 @@ protected:
// Common part of DoDrawText() and DoDrawRotatedText()
void DrawAnyText(const wxWX2MBbuf& textbuf, wxCoord testDescent, double lineHeight);
// Actually set PostScript font
void SetPSFont();
FILE* m_pstream; // PostScript output stream
unsigned char m_currentRed;
@@ -151,6 +153,7 @@ protected:
wxPrintData m_printData;
double m_pageHeight;
wxArrayString m_definedPSFonts;
bool m_isFontChanged;
private:
wxDECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl);