fontscalerdefs.h revision 4063
0N/A/*
3157N/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
0N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/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,
1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1472N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A * or visit www.oracle.com if you need additional information or have any
0N/A * questions.
0N/A */
1879N/A
1879N/A#ifndef FontScalerDefsIncludesDefined
1879N/A#define FontScalerDefsIncludesDefined
1879N/A
1879N/A#include "AccelGlyphCache.h"
1879N/A
1879N/A#ifdef __cplusplus
1879N/Aextern "C" {
1879N/A#endif
1879N/A
2771N/A#define kPosInfinity16 (32767)
1879N/A#define kNegInfinity16 (-32768)
1879N/A
3879N/A#define kPosInfinity32 (0x7fffffff)
1879N/A#define kNegInfinity32 (0x80000000)
1879N/A
1879N/A
1879N/A#ifdef _LP64
1879N/Atypedef unsigned int UInt32;
1879N/Atypedef int Int32;
1879N/A#else
1879N/Atypedef unsigned long UInt32;
1879N/Atypedef long Int32;
1879N/A#endif
1879N/Atypedef unsigned short UInt16;
1879N/Atypedef short Int16;
1879N/Atypedef unsigned char UInt8;
1879N/A
1879N/Atypedef UInt8 Byte;
1879N/Atypedef Int32 hsFixed;
1879N/Atypedef Int32 hsFract;
1879N/Atypedef UInt32 Bool32;
1879N/A
1879N/A#ifndef __cplusplus
1879N/A#ifndef false
1879N/A #define false 0
1879N/A#endif
1879N/A
1879N/A#ifndef true
1879N/A #define true 1
1879N/A#endif
1879N/A#endif
1879N/A
1879N/A#define kPosInfinity32 (0x7fffffff)
1879N/A#define kNegInfinity32 (0x80000000)
1879N/A
1879N/A#define F26Dot6ToFixed(n) ((n) << 10)
1879N/A#define F26Dot6ToScalar(n) (((t2kScalar)(n)) / (t2kScalar)64)
1879N/A
1879N/A /* t2kFixed is the same as F16Dot16 format although T2K also uses 26.6 */
1879N/Atypedef Int32 t2kFixed;
1879N/Atypedef float t2kScalar;
2796N/A
2796N/A#define t2kIntToFixed(x) ((t2kFixed)(x) << 16)
2796N/A#define t2kFixedToInt(x) ((x) >> 16)
1879N/A
0N/A#define t2kFixedRound(x) (((x) + 0x8000) >> 16)
0N/A#define t2kFixed1 t2kIntToFixed(1)
2842N/A
1324N/A#define t2kFloatToFixed(f) (t2kFixed)((f) * (float)(t2kFixed1))
1324N/A#define t2kFixedToFloat(x) ((x) / (float)(65536))
1324N/A
2842N/A#define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2))
1324N/A
0N/A /* managed: 1 means the glyph has a hardware cached
0N/A * copy, and its freeing is managed by the the usual
0N/A * 2D disposer code.
0N/A * A value of 0 means its either unaccelerated (and so has no cellInfos)
0N/A * or we want to free this in a different way.
0N/A * The field uses previously unused padding, so doesn't enlarge
0N/A * the structure.
0N/A */
0N/A#define UNMANAGED_GLYPH 0
0N/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;
0N/A UInt8 managed;
0N/A float topLeftX;
0N/A float topLeftY;
0N/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' */
0N/A#define KERN_TAG 0x6B65726E /* 'kern' */
0N/A
0N/Atypedef struct TTLayoutTableCache {
0N/A void* gsub;
657N/A void* gpos;
0N/A void* gdef;
0N/A void* mort;
0N/A void* kern;
0N/A void* kernPairs;
0N/A int gsub_len;
0N/A int gpos_len;
2062N/A int gdef_len;
0N/A int mort_len;
2062N/A int kern_len;
0N/A} TTLayoutTableCache;
0N/A
0N/A#include "sunfontids.h"
0N/A
0N/AJNIEXPORT extern TTLayoutTableCache* newLayoutTableCache();
0N/AJNIEXPORT extern void freeLayoutTableCache(TTLayoutTableCache* ltc);
1142N/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
0N/A