Debian Codegraph @

texk/lcdf-typetools/lcdf-typetools-src/libefont/otfdata.cc

raw
1 // -*- related-file-name: "../include/efont/otfdata.hh" -*-
2
3 /* otfdata.{cc,hh} -- OpenType bounds-checked string type
4 *
5 * Copyright (c) 2003-2019 Eddie Kohler
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version. This program is distributed in the hope that it will be
11 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 * Public License for more details.
14 */
15
16 #ifdef HAVE_CONFIG_H
17 # include <config.h>
18 #endif
19 #include <efont/otfdata.hh>
20
21 namespace Efont { namespace OpenType {
22
23 Data
24 Data::subtable(unsigned offset) const
25 {
26 if (offset > (unsigned) _str.length())
27 throw Bounds();
28 return Data(_str.substring(offset));
29 }
30
31 Data
32 Data::offset_subtable(unsigned offset_offset) const
33 {
34 int offset = u16(offset_offset);
35 if (offset > _str.length())
36 throw Bounds();
37 return Data(_str.substring(offset));
38 }
39
40 }}
41
42 // template instantiations
43 #include <lcdf/vector.cc>