0N/A/*
3261N/A * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#ifndef FontScalerDefsIncludesDefined
0N/A#define FontScalerDefsIncludesDefined
0N/A
0N/A#include "AccelGlyphCache.h"
0N/A
0N/A#ifdef __cplusplus
0N/Aextern "C" {
0N/A#endif
0N/A
0N/A#define kPosInfinity16 (32767)
0N/A#define kNegInfinity16 (-32768)
0N/A
0N/A#define kPosInfinity32 (0x7fffffff)
0N/A#define kNegInfinity32 (0x80000000)
0N/A
0N/A
0N/A#ifdef _LP64
0N/Atypedef unsigned int UInt32;
0N/Atypedef int Int32;
0N/A#else
0N/Atypedef unsigned long UInt32;
0N/Atypedef long Int32;
0N/A#endif
0N/Atypedef unsigned short UInt16;
0N/Atypedef short Int16;
0N/Atypedef unsigned char UInt8;
0N/A
0N/Atypedef UInt8 Byte;
0N/Atypedef Int32 hsFixed;
0N/Atypedef Int32 hsFract;
0N/Atypedef UInt32 Bool32;
0N/A
4063N/A#ifndef __cplusplus
0N/A#ifndef false
4063N/A #define false 0
0N/A#endif
0N/A
0N/A#ifndef true
0N/A #define true 1
0N/A#endif
4063N/A#endif
0N/A
0N/A#define kPosInfinity32 (0x7fffffff)
0N/A#define kNegInfinity32 (0x80000000)
0N/A
0N/A#define F26Dot6ToFixed(n) ((n) << 10)
0N/A#define F26Dot6ToScalar(n) (((t2kScalar)(n)) / (t2kScalar)64)
0N/A
0N/A /* t2kFixed is the same as F16Dot16 format although T2K also uses 26.6 */
0N/Atypedef Int32 t2kFixed;
0N/Atypedef float t2kScalar;
0N/A
0N/A#define t2kIntToFixed(x) ((t2kFixed)(x) << 16)
0N/A#define t2kFixedToInt(x) ((x) >> 16)
0N/A
0N/A#define t2kFixedRound(x) (((x) + 0x8000) >> 16)
0N/A#define t2kFixed1 t2kIntToFixed(1)
0N/A
0N/A#define t2kFloatToFixed(f) (t2kFixed)((f) * (float)(t2kFixed1))
0N/A#define t2kFixedToFloat(x) ((x) / (float)(65536))
0N/A
0N/A#define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2))
0N/A
2370N/A /* managed: 1 means the glyph has a hardware cached
2370N/A * copy, and its freeing is managed by the the usual
2370N/A * 2D disposer code.
2370N/A * A value of 0 means its either unaccelerated (and so has no cellInfos)
2370N/A * or we want to free this in a different way.
2370N/A * The field uses previously unused padding, so doesn't enlarge
2370N/A * the structure.
2370N/A */
2370N/A#define UNMANAGED_GLYPH 0
2370N/A#define MANAGED_GLYPH 1
0N/Atypedef struct GlyphInfo {
0N/A float advanceX;
0N/A float advanceY;
0N/A UInt16 width;
0N/A UInt16 height;
0N/A UInt16 rowBytes;
2370N/A UInt8 managed;
0N/A float topLeftX;
0N/A float topLeftY;
2370N/A void *cellInfo;
0N/A UInt8 *image;
0N/A} GlyphInfo;
0N/A
0N/A /* We use fffe and ffff as meaning invisible glyphs which have no
0N/A * image, or advance and an empty outline.
0N/A * Since there are no valid glyphs with this great a value (watch out for
0N/A * large fonts in the future!) we can safely use check for >= this value
0N/A */
0N/A#define INVISIBLE_GLYPHS 0xfffe
0N/A
0N/A#define GSUB_TAG 0x47535542 /* 'GSUB' */
0N/A#define GPOS_TAG 0x47504F53 /* 'GPOS' */
0N/A#define GDEF_TAG 0x47444546 /* 'GDEF' */
0N/A#define MORT_TAG 0x6D6F7274 /* 'mort' */
5980N/A#define MORX_TAG 0x6D6F7278 /* 'morx' */
0N/A#define KERN_TAG 0x6B65726E /* 'kern' */
0N/A
5980N/Atypedef struct TTLayoutTableCacheEntry {
5980N/A const void* ptr;
5980N/A int len;
5980N/A} TTLayoutTableCacheEntry;
5980N/A
5980N/A#define LAYOUTCACHE_ENTRIES 6
5980N/A
0N/Atypedef struct TTLayoutTableCache {
5980N/A TTLayoutTableCacheEntry entries[LAYOUTCACHE_ENTRIES];
5980N/A void* kernPairs;
0N/A} TTLayoutTableCache;
0N/A
0N/A#include "sunfontids.h"
0N/A
0N/AJNIEXPORT extern TTLayoutTableCache* newLayoutTableCache();
0N/AJNIEXPORT extern void freeLayoutTableCache(TTLayoutTableCache* ltc);
0N/A
0N/A/* If font is malformed then scaler context created by particular scaler
0N/A * will be replaced by null scaler context.
0N/A * Note that this context is not compatible with structure of the context
0N/A * object used by particular scaler. Therefore, before using context
0N/A * scaler has to check if it is NullContext.
0N/A *
0N/A * Note that in theory request with NullContext should not even reach native
0N/A * scaler.
0N/A *
0N/A * It seems that the only reason to support NullContext is to simplify
0N/A * FileFontStrike logic - presence of context is used as marker to
0N/A * free the memory.
0N/A*/
0N/AJNIEXPORT int isNullScalerContext(void *context);
0N/A
0N/A#ifdef __cplusplus
0N/A}
0N/A#endif
0N/A
0N/A#endif