| 1 | /* Copyright (C) 2000-2012 by George Williams */ |
| 2 | /* |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are met: |
| 5 | |
| 6 | * Redistributions of source code must retain the above copyright notice, this |
| 7 | * list of conditions and the following disclaimer. |
| 8 | |
| 9 | * Redistributions in binary form must reproduce the above copyright notice, |
| 10 | * this list of conditions and the following disclaimer in the documentation |
| 11 | * and/or other materials provided with the distribution. |
| 12 | |
| 13 | * The name of the author may not be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 19 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #ifndef FONTFORGE_FFFREETYPE_H |
| 29 | #define FONTFORGE_FFFREETYPE_H |
| 30 | |
| 31 | #include "baseviews.h" |
| 32 | |
| 33 | #include <ft2build.h> |
| 34 | #include FT_FREETYPE_H |
| 35 | #include FT_OUTLINE_H |
| 36 | |
| 37 | #if FREETYPE_MINOR >= 5 |
| 38 | # include FT_TRUETYPE_DRIVER_H |
| 39 | #endif |
| 40 | |
| 41 | #if defined(FREETYPE_HAS_DEBUGGER) |
| 42 | #if FREETYPE_MAJOR == 2 && (FREETYPE_MINOR < 10 || (FREETYPE_MINOR == 10 && FREETYPE_PATCH < 3)) |
| 43 | # include <internal/internal.h> |
| 44 | # endif |
| 45 | # include <ttdriver.h> |
| 46 | # include <ttinterp.h> |
| 47 | # include <ttobjs.h> |
| 48 | #endif |
| 49 | |
| 50 | #if defined(__MINGW32__) || defined(_MSC_VER) |
| 51 | # include <Winsock2.h> |
| 52 | # include <Windows.h> |
| 53 | #else |
| 54 | # include <sys/mman.h> |
| 55 | #endif |
| 56 | |
| 57 | #include "ffunistd.h" |
| 58 | |
| 59 | extern FT_Library ff_ft_context; |
| 60 | |
| 61 | |
| 62 | typedef struct freetypecontext { |
| 63 | SplineFont *sf; |
| 64 | int layer; |
| 65 | FILE *file; |
| 66 | void *mappedfile; |
| 67 | long len; |
| 68 | int *glyph_indeces; |
| 69 | FT_Face face; |
| 70 | struct freetypecontext *shared_ftc; /* file, mappedfile, glyph_indeces are shared with this ftc */ |
| 71 | /* We have a new face, but that's it. This is so we can */ |
| 72 | /* have multiple pointsizes without loading the font many */ |
| 73 | /* times */ |
| 74 | int isttf; |
| 75 | int em; /* Em size in the spline font, not ppem */ |
| 76 | } FTC; |
| 77 | |
| 78 | extern void *__FreeTypeFontContext(FT_Library context, |
| 79 | SplineFont *sf,SplineChar *sc,FontViewBase *fv, |
| 80 | int layer, |
| 81 | enum fontformat ff,int flags,void *shared_ftc); |
| 82 | |
| 83 | #endif /* FONTFORGE_FFFREETYPE_H */ |