summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/ttf/PostTable.cpp
blob: 650faf5467fe1f3afa6469bda80ced82f9f8060f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*************************************************************************
** PostTable.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 "PostTable.hpp"
#include "TTFWriter.hpp"
#include "../Font.hpp"

using namespace std;
using namespace ttf;

#if 0
/** Writes a string in Pascal format to an output stream. The string should not be
 *  longer than 255 characters. Otherwise, it's truncated accordingly. */
static void write_pascal_string (ostream &os, const string &str) {
	size_t len = std::min(str.length(), size_t(255));
	writeUInt8(os, len);   // first byte determines the string length
	for (size_t i=0; i < len; i++)
		writeUInt8(os, str[i]);
}
#endif


void PostTable::write (ostream &os) const {
	writeUInt32(os, 0x30000);   // table version 3
	writeInt32(os, 0);   // italic angle
	writeInt16(os, 0);   // underline position
	writeInt16(os, 0);   // underline thickness
	writeUInt32(os, ttfWriter()->isFixedPitch());  // 1 = fixed pitch
	writeUInt32(os, 0);  // minMemType42
	writeUInt32(os, 0);  // maxMemType42
	writeUInt32(os, 0);  // minMemType1
	writeUInt32(os, 0);  // maxMemType1
/*	writeUInt16(os, ttfWriter()->getUnicodeCharMap().numValues());
	// write name indexes in glyph ID order (index 0 = ".notdef")
	uint16_t index=0;
	for (auto cp2charcode : ttfWriter()->getUnicodeCharMap()) {
		string name = ttfWriter()->getFont().glyphName(cp2charcode.second);
		writeUInt16(os, name.empty() || name == ".notdef" ? 0 : ++index);
	}
	// write the glyph names in glyph ID order
	for (auto cp2charcode : ttfWriter()->getUnicodeCharMap()) {
		string name = ttfWriter()->getFont().glyphName(cp2charcode.second);
		if (!name.empty() && name != ".notdef")
			write_pascal_string(os, name);
	}*/
}