| 1 | /* |
| 2 | * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Oracle designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Oracle in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 22 | * or visit www.oracle.com if you need additional information or have any |
| 23 | * questions. |
| 24 | */ |
| 25 | |
| 26 | #ifndef FontScalerDefsIncludesDefined |
| 27 | #define FontScalerDefsIncludesDefined |
| 28 | |
| 29 | #include "AccelGlyphCache.h" |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
| 35 | #ifdef _LP64 |
| 36 | typedef unsigned int UInt32; |
| 37 | typedef int Int32; |
| 38 | #else |
| 39 | typedef unsigned long UInt32; |
| 40 | typedef long Int32; |
| 41 | #endif |
| 42 | typedef unsigned short UInt16; |
| 43 | typedef short Int16; |
| 44 | typedef unsigned char UInt8; |
| 45 | |
| 46 | typedef UInt8 Byte; |
| 47 | typedef Int32 hsFixed; |
| 48 | typedef Int32 hsFract; |
| 49 | typedef UInt32 Bool32; |
| 50 | |
| 51 | #ifndef __cplusplus |
| 52 | #ifndef false |
| 53 | #define false 0 |
| 54 | #endif |
| 55 | |
| 56 | #ifndef true |
| 57 | #define true 1 |
| 58 | #endif |
| 59 | #endif |
| 60 | |
| 61 | /* managed: 1 means the glyph has a hardware cached |
| 62 | * copy, and its freeing is managed by the usual |
| 63 | * 2D disposer code. |
| 64 | * A value of 0 means its either unaccelerated (and so has no cellInfos) |
| 65 | * or we want to free this in a different way. |
| 66 | * The field uses previously unused padding, so doesn't enlarge |
| 67 | * the structure. |
| 68 | */ |
| 69 | #define UNMANAGED_GLYPH 0 |
| 70 | #define MANAGED_GLYPH 1 |
| 71 | typedef struct GlyphInfo { |
| 72 | float advanceX; |
| 73 | float advanceY; |
| 74 | UInt16 width; |
| 75 | UInt16 height; |
| 76 | UInt16 rowBytes; |
| 77 | UInt8 managed; |
| 78 | float topLeftX; |
| 79 | float topLeftY; |
| 80 | void *cellInfo; |
| 81 | UInt8 *image; |
| 82 | } GlyphInfo; |
| 83 | |
| 84 | /* We use fffe and ffff as meaning invisible glyphs which have no |
| 85 | * image, or advance and an empty outline. |
| 86 | * Since there are no valid glyphs with this great a value (watch out for |
| 87 | * large fonts in the future!) we can safely use check for >= this value |
| 88 | */ |
| 89 | #define INVISIBLE_GLYPHS 0xfffe |
| 90 | |
| 91 | #include "sunfontids.h" |
| 92 | |
| 93 | /* If font is malformed then scaler context created by particular scaler |
| 94 | * will be replaced by null scaler context. |
| 95 | * Note that this context is not compatible with structure of the context |
| 96 | * object used by particular scaler. Therefore, before using context |
| 97 | * scaler has to check if it is NullContext. |
| 98 | * |
| 99 | * Note that in theory request with NullContext should not even reach native |
| 100 | * scaler. |
| 101 | * |
| 102 | * It seems that the only reason to support NullContext is to simplify |
| 103 | * FileFontStrike logic - presence of context is used as marker to |
| 104 | * free the memory. |
| 105 | */ |
| 106 | JNIEXPORT int isNullScalerContext(void *context); |
| 107 | |
| 108 | #ifdef __cplusplus |
| 109 | } |
| 110 | #endif |
| 111 | |
| 112 | #endif |
| 113 | |