File: util.h

package info (click to toggle)
lasi 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 1,420 kB
  • ctags: 1,269
  • sloc: cpp: 1,049; makefile: 13
file content (34 lines) | stat: -rw-r--r-- 1,096 bytes parent folder | download | duplicates (5)
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
/** @file
 * Convert return-code of Freetype library calls to std::runtime_error.
 * Usage: place every call to Freetype library inside FtEval::eval().
 *
 * libLASi provides a C++ output stream interface for writing multi-language Postscript documents.
 * Copyright (C) 2003, 2004 by Larry Siden.
 *
 * See README file in project root directory for copyright and contact info.
 * See COPYING file in project root for terms of re-distribution.
 */

#ifndef UTIL_H
#define UTIL_H

#include <stdexcept>
#include <string>
#include <iostream>

#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H

std::ostream& operator<<(std::ostream&, const FT_Library);
std::ostream& operator<<(std::ostream&, const FT_Face);
std::ostream& operator<<(std::ostream&, const FT_Glyph);
std::ostream& operator<<(std::ostream&, const FT_Outline);

/** Converts a freetype return code into an exception.
 */
inline void evalReturnCode(const int errCode, const char* funcName) throw (std::runtime_error) {
  if (errCode)
    throw std::runtime_error(std::string("Error returned from ") + funcName);
}
#endif