Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/font/fontscalerdefs.h
38829 views
/*1* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef FontScalerDefsIncludesDefined26#define FontScalerDefsIncludesDefined2728#include "AccelGlyphCache.h"2930#ifdef __cplusplus31extern "C" {32#endif3334#define kPosInfinity16 (32767)35#define kNegInfinity16 (-32768)3637#define kPosInfinity32 (0x7fffffff)38#define kNegInfinity32 (0x80000000)394041#ifdef _LP6442typedef unsigned int UInt32;43typedef int Int32;44#else45typedef unsigned long UInt32;46typedef long Int32;47#endif48typedef unsigned short UInt16;49typedef short Int16;50typedef unsigned char UInt8;5152typedef UInt8 Byte;53typedef Int32 hsFixed;54typedef Int32 hsFract;55typedef UInt32 Bool32;5657#ifndef __cplusplus58#ifndef false59#define false 060#endif6162#ifndef true63#define true 164#endif65#endif6667#define kPosInfinity32 (0x7fffffff)68#define kNegInfinity32 (0x80000000)6970#define F26Dot6ToFixed(n) ((n) << 10)71#define F26Dot6ToScalar(n) (((t2kScalar)(n)) / (t2kScalar)64)7273/* t2kFixed is the same as F16Dot16 format although T2K also uses 26.6 */74typedef Int32 t2kFixed;75typedef float t2kScalar;7677#define t2kIntToFixed(x) ((t2kFixed)(x) << 16)78#define t2kFixedToInt(x) ((x) >> 16)7980#define t2kFixedRound(x) (((x) + 0x8000) >> 16)81#define t2kFixed1 t2kIntToFixed(1)8283#define t2kFloatToFixed(f) (t2kFixed)((f) * (float)(t2kFixed1))84#define t2kFixedToFloat(x) ((x) / (float)(65536))8586#define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2))8788/* managed: 1 means the glyph has a hardware cached89* copy, and its freeing is managed by the the usual90* 2D disposer code.91* A value of 0 means its either unaccelerated (and so has no cellInfos)92* or we want to free this in a different way.93* The field uses previously unused padding, so doesn't enlarge94* the structure.95*/96#define UNMANAGED_GLYPH 097#define MANAGED_GLYPH 198typedef struct GlyphInfo {99float advanceX;100float advanceY;101UInt16 width;102UInt16 height;103UInt16 rowBytes;104UInt8 managed;105float topLeftX;106float topLeftY;107void *cellInfo;108UInt8 *image;109} GlyphInfo;110111/* We use fffe and ffff as meaning invisible glyphs which have no112* image, or advance and an empty outline.113* Since there are no valid glyphs with this great a value (watch out for114* large fonts in the future!) we can safely use check for >= this value115*/116#define INVISIBLE_GLYPHS 0xfffe117118#define GSUB_TAG 0x47535542 /* 'GSUB' */119#define GPOS_TAG 0x47504F53 /* 'GPOS' */120#define GDEF_TAG 0x47444546 /* 'GDEF' */121#define MORT_TAG 0x6D6F7274 /* 'mort' */122#define MORX_TAG 0x6D6F7278 /* 'morx' */123#define KERN_TAG 0x6B65726E /* 'kern' */124125typedef struct TTLayoutTableCacheEntry {126const void* ptr;127int len;128} TTLayoutTableCacheEntry;129130#define LAYOUTCACHE_ENTRIES 6131132typedef struct TTLayoutTableCache {133TTLayoutTableCacheEntry entries[LAYOUTCACHE_ENTRIES];134void* kernPairs;135} TTLayoutTableCache;136137#include "sunfontids.h"138139JNIEXPORT extern TTLayoutTableCache* newLayoutTableCache();140JNIEXPORT extern void freeLayoutTableCache(TTLayoutTableCache* ltc);141142/* If font is malformed then scaler context created by particular scaler143* will be replaced by null scaler context.144* Note that this context is not compatible with structure of the context145* object used by particular scaler. Therefore, before using context146* scaler has to check if it is NullContext.147*148* Note that in theory request with NullContext should not even reach native149* scaler.150*151* It seems that the only reason to support NullContext is to simplify152* FileFontStrike logic - presence of context is used as marker to153* free the memory.154*/155JNIEXPORT int isNullScalerContext(void *context);156157#ifdef __cplusplus158}159#endif160161#endif162163164