summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/ttf/MaxpTable.cpp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-01-12 03:01:29 +0000
committerNorbert Preining <norbert@preining.info>2023-01-12 03:01:29 +0000
commit6a7900c93acc16d1bbd2f1e26286c7dd7387e6c0 (patch)
tree76196287351cba68a51934c49468bf1a7846aa76 /dviware/dvisvgm/src/ttf/MaxpTable.cpp
parentc1c19023b4b1d43cb874f84df5102b485853e672 (diff)
CTAN sync 202301120301
Diffstat (limited to 'dviware/dvisvgm/src/ttf/MaxpTable.cpp')
-rw-r--r--dviware/dvisvgm/src/ttf/MaxpTable.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/dviware/dvisvgm/src/ttf/MaxpTable.cpp b/dviware/dvisvgm/src/ttf/MaxpTable.cpp
new file mode 100644
index 0000000000..176c9ffcb0
--- /dev/null
+++ b/dviware/dvisvgm/src/ttf/MaxpTable.cpp
@@ -0,0 +1,50 @@
+/*************************************************************************
+** MaxpTable.cpp **
+** **
+** This file is part of dvisvgm -- a fast DVI to SVG converter **
+** Copyright (C) 2005-2023 Martin Gieseking <martin.gieseking@uos.de> **
+** **
+** This program is free software; you can redistribute it and/or **
+** modify it under the terms of the GNU General Public License as **
+** published by the Free Software Foundation; either version 3 of **
+** the License, or (at your option) any later version. **
+** **
+** This program is distributed in the hope that it will be useful, but **
+** WITHOUT ANY WARRANTY; without even the implied warranty of **
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
+** GNU General Public License for more details. **
+** **
+** You should have received a copy of the GNU General Public License **
+** along with this program; if not, see <http://www.gnu.org/licenses/>. **
+*************************************************************************/
+
+#include <algorithm>
+#include "MaxpTable.hpp"
+#include "TTFWriter.hpp"
+
+using namespace std;
+using namespace ttf;
+
+void MaxpTable::write (ostream &os) const {
+ writeUInt32(os, 0x10000); // version 1.0, required for TTF fonts
+ writeUInt16(os, ttfWriter()->getUnicodeCharMap().numValues()+1); // number of glyphs including .notdef
+ writeUInt16(os, _maxPoints);
+ writeUInt16(os, _maxContours);
+ writeUInt16(os, 0); // maxCompositePoints
+ writeUInt16(os, 0); // maxCompositeContours
+ writeUInt16(os, 1); // maxZones (1 = don't use twilight zone, 2 otherwise)
+ writeUInt16(os, 0); // maxTwilightPoints
+ writeUInt16(os, 0); // maxStorage
+ writeUInt16(os, 0); // maxFunctionDefs
+ writeUInt16(os, 0); // maxInstructionDefs
+ writeUInt16(os, 0); // maxStackElements
+ writeUInt16(os, 0); // maxSizeOfInstructions
+ writeUInt16(os, 0); // maxComponentElements
+ writeUInt16(os, 0); // maxComponentDepth
+}
+
+
+void MaxpTable::updateContourInfo (uint16_t maxPoints, uint16_t maxContours) {
+ _maxPoints = max(_maxPoints, maxPoints);
+ _maxContours = max(_maxContours, maxContours);
+} \ No newline at end of file