@@ -150,81 +150,6 @@ static PyObject *convert_ttf_to_ps(PyObject *self, PyObject *args, PyObject *kwd
150150 return Py_None;
151151}
152152
153- class PythonDictionaryCallback : public TTDictionaryCallback
154- {
155- PyObject *_dict;
156-
157- public:
158- PythonDictionaryCallback (PyObject *dict)
159- {
160- _dict = dict;
161- }
162-
163- virtual void add_pair (const char *a, const char *b)
164- {
165- assert (a != NULL );
166- assert (b != NULL );
167- PyObject *value = PyBytes_FromString (b);
168- if (!value) {
169- throw py::exception ();
170- }
171- if (PyDict_SetItemString (_dict, a, value)) {
172- Py_DECREF (value);
173- throw py::exception ();
174- }
175- Py_DECREF (value);
176- }
177- };
178-
179- static PyObject *py_get_pdf_charprocs (PyObject *self, PyObject *args, PyObject *kwds)
180- {
181- const char *filename;
182- std::vector<int > glyph_ids;
183- PyObject *result;
184-
185- static const char *kwlist[] = { " filename" , " glyph_ids" , NULL };
186- if (!PyArg_ParseTupleAndKeywords (args,
187- kwds,
188- " y|O&:get_pdf_charprocs" ,
189- (char **)kwlist,
190- &filename,
191- pyiterable_to_vector_int,
192- &glyph_ids)) {
193- return NULL ;
194- }
195-
196- result = PyDict_New ();
197- if (!result) {
198- return NULL ;
199- }
200-
201- PythonDictionaryCallback dict (result);
202-
203- try
204- {
205- ::get_pdf_charprocs (filename, glyph_ids, dict);
206- }
207- catch (TTException &e)
208- {
209- Py_DECREF (result);
210- PyErr_SetString (PyExc_RuntimeError, e.getMessage ());
211- return NULL ;
212- }
213- catch (const py::exception &)
214- {
215- Py_DECREF (result);
216- return NULL ;
217- }
218- catch (...)
219- {
220- Py_DECREF (result);
221- PyErr_SetString (PyExc_RuntimeError, " Unknown C++ exception" );
222- return NULL ;
223- }
224-
225- return result;
226- }
227-
228153static PyMethodDef ttconv_methods[] =
229154{
230155 {
@@ -245,20 +170,6 @@ static PyMethodDef ttconv_methods[] =
245170 " then all glyphs will be included. If any of the glyphs specified are "
246171 " composite glyphs, then the component glyphs will also be included."
247172 },
248- {
249- " get_pdf_charprocs" , (PyCFunction)py_get_pdf_charprocs, METH_VARARGS | METH_KEYWORDS,
250- " get_pdf_charprocs(filename, glyph_ids)\n "
251- " \n "
252- " Given a Truetype font file, returns a dictionary containing the PDF Type 3\n "
253- " representation of its paths. Useful for subsetting a Truetype font inside\n "
254- " of a PDF file.\n "
255- " \n "
256- " filename is the path to a TTF font file.\n "
257- " glyph_ids is a list of the numeric glyph ids to include.\n "
258- " The return value is a dictionary where the keys are glyph names and\n "
259- " the values are the stream content needed to render that glyph. This\n "
260- " is useful to generate the CharProcs dictionary in a PDF Type 3 font.\n "
261- },
262173 {0 , 0 , 0 , 0 } /* Sentinel */
263174};
264175
0 commit comments