wxMaxima
Loading...
Searching...
No Matches
pdffontsubsettruetype.h
Go to the documentation of this file.
1
2// Name: pdffontsubsettruetype.h
3// Purpose:
4// Author: Ulrich Telle
5// Created: 2005-11-20
6// Copyright: (c) Ulrich Telle
7// Licence: wxWindows licence
9
11
12#ifndef _PDF_FONT_SUBSET_TRUETYPE_H_
13#define _PDF_FONT_SUBSET_TRUETYPE_H_
14
15// wxWidgets headers
16#include <wx/string.h>
17#include <wx/mstream.h>
18#include <wx/wfstream.h>
19
20// wxPdfDocument headers
21#include "wx/pdfdocdef.h"
22#include "wx/pdffontparser.h"
24
28{
29public:
31 wxPdfFontSubsetTrueType(const wxString& fileName, int fontIndex = 0, bool isMacCoreText = false);
32
35
37
43 wxMemoryOutputStream* CreateSubset(wxInputStream* inFont,
44 wxPdfSortedArrayInt* glyphsUsed,
45 bool includeCmap = false);
46#if defined(__WXMAC__)
47#if wxPDFMACOSX_HAS_CORE_TEXT
49 void SetCTFontRef(const wxFont& font);
50#endif
51#endif
52
53protected:
55 bool ReadLocaTable();
56
58 bool CheckGlyphs();
59
61 void FindGlyphComponents(int glyph);
62
64 void CreateNewTables();
65
67 void WriteSubsetFont();
68
70 void WriteShort(int n);
71
73 void WriteInt(int n);
74
76 void WriteString(const wxString& s);
77
79 void WriteShortToBuffer(int n, char buffer[2]);
80
82 void WriteIntToBuffer(int n, char buffer[4]);
83
84private:
85 wxMemoryOutputStream* m_outFont;
86
87 wxPdfSortedArrayInt* m_usedGlyphs;
88
89 int m_fontIndex;
90 bool m_includeCmap;
91
92 bool m_locaTableIsShort;
93 int* m_locaTable;
94 size_t m_locaTableSize;
95 size_t m_locaTableRealSize;
96
97 int* m_newLocaTable;
98 char* m_newLocaTableStream;
99 size_t m_newLocaTableStreamSize;
100
101 int m_glyfTableOffset;
102 char* m_newGlyfTable;
103 size_t m_newGlyfTableSize;
104 size_t m_newGlyfTableRealSize;
105};
106
107#endif
Class representing a TrueType/OpenType font parser.
Definition: pdffontparsertruetype.h:59
Class representing TrueType Font Subsets. (For internal use only)
Definition: pdffontsubsettruetype.h:28
void WriteIntToBuffer(int n, char buffer[4])
Write an integer to a buffer.
Definition: pdffontsubsettruetype.cpp:459
void WriteSubsetFont()
Write the subset of the font.
Definition: pdffontsubsettruetype.cpp:322
virtual ~wxPdfFontSubsetTrueType()
Default destructor.
Definition: pdffontsubsettruetype.cpp:39
void WriteString(const wxString &s)
Write a stringto the default output stream.
Definition: pdffontsubsettruetype.cpp:468
bool CheckGlyphs()
Check glyphs.
Definition: pdffontsubsettruetype.cpp:144
void WriteInt(int n)
Write an integer to the default output stream.
Definition: pdffontsubsettruetype.cpp:451
bool ReadLocaTable()
Read 'loca' table.
Definition: pdffontsubsettruetype.cpp:99
wxMemoryOutputStream * CreateSubset(wxInputStream *inFont, wxPdfSortedArrayInt *glyphsUsed, bool includeCmap=false)
Create subset of a font.
Definition: pdffontsubsettruetype.cpp:60
void CreateNewTables()
Create a new table.
Definition: pdffontsubsettruetype.cpp:230
void WriteShortToBuffer(int n, char buffer[2])
Write a short integer to a buffer.
Definition: pdffontsubsettruetype.cpp:444
void WriteShort(int n)
Write a short integer to the default output stream.
Definition: pdffontsubsettruetype.cpp:436
void FindGlyphComponents(int glyph)
Find the components of a glyph.
Definition: pdffontsubsettruetype.cpp:182
Compile time switches for the wxPdfDocument component.
Interface of the TrueType/OpenType font parsing support classes.
Interface of the TrueType Font support classes.