| 1 | // SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later |
| 2 | // Copyright 2012, SIL International, All rights reserved. |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | //#include "inc/FeatureMap.h" |
| 7 | //#include "inc/GlyphsCache.h" |
| 8 | //#include "inc/Silf.h" |
| 9 | |
| 10 | #ifndef GRAPHITE2_NFILEFACE |
| 11 | |
| 12 | #include <cstdio> |
| 13 | #include <cassert> |
| 14 | |
| 15 | #include "graphite2/Font.h" |
| 16 | |
| 17 | #include "inc/Main.h" |
| 18 | #include "inc/TtfTypes.h" |
| 19 | #include "inc/TtfUtil.h" |
| 20 | |
| 21 | namespace graphite2 { |
| 22 | |
| 23 | |
| 24 | class FileFace |
| 25 | { |
| 26 | static const void * get_table_fn(const void* appFaceHandle, unsigned int name, size_t *len); |
| 27 | static void rel_table_fn(const void* appFaceHandle, const void *table_buffer); |
| 28 | |
| 29 | public: |
| 30 | static const gr_face_ops ops; |
| 31 | |
| 32 | FileFace(const char *filename); |
| 33 | ~FileFace(); |
| 34 | |
| 35 | operator bool () const throw(); |
| 36 | CLASS_NEW_DELETE; |
| 37 | |
| 38 | private: //defensive |
| 39 | FILE * _file; |
| 40 | size_t _file_len; |
| 41 | |
| 42 | TtfUtil::Sfnt::OffsetSubTable * _header_tbl; |
| 43 | TtfUtil::Sfnt::OffsetSubTable::Entry * _table_dir; |
| 44 | |
| 45 | FileFace(const FileFace&); |
| 46 | FileFace& operator=(const FileFace&); |
| 47 | }; |
| 48 | |
| 49 | inline |
| 50 | FileFace::operator bool() const throw() |
| 51 | { |
| 52 | return _file && _header_tbl && _table_dir; |
| 53 | } |
| 54 | |
| 55 | } // namespace graphite2 |
| 56 | |
| 57 | #endif //!GRAPHITE2_NFILEFACE |
| 58 | |