1/*
2 * Copyright (c) 2003, 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 _X11FONTSCALER_H_
27#define _X11FONTSCALER_H_
28
29#include "gdefs.h"
30
31#ifndef HEADLESS
32#include <X11/Xlib.h>
33#endif
34
35#define SHIFTFACTOR 16
36#define NO_POINTSIZE -1.0
37
38#ifdef HEADLESS
39
40typedef struct {
41 unsigned char byte1;
42 unsigned char byte2;
43} AWTChar2b;
44
45#define Success 1
46
47#else /* !HEADLESS */
48
49extern Display *awt_display;
50typedef XChar2b AWTChar2b;
51
52#endif /* !HEADLESS */
53
54typedef void *AWTChar;
55typedef void *AWTFont;
56
57typedef struct NativeScalerContext {
58 AWTFont xFont;
59 int minGlyph;
60 int maxGlyph;
61 int numGlyphs;
62 int defaultGlyph;
63 int ptSize;
64 double scale;
65} NativeScalerContext;
66
67
68/*
69 * Important note : All AWTxxx functions are defined in font.h.
70 * These were added to remove the dependency of certain files on X11.
71 * These functions are used to perform X11 operations and should
72 * be "stubbed out" in environments that do not support X11.
73 */
74JNIEXPORT int JNICALL AWTCountFonts(char* xlfd);
75JNIEXPORT void JNICALL AWTLoadFont(char* name, AWTFont* pReturn);
76JNIEXPORT void JNICALL AWTFreeFont(AWTFont font);
77JNIEXPORT unsigned JNICALL AWTFontMinByte1(AWTFont font);
78JNIEXPORT unsigned JNICALL AWTFontMaxByte1(AWTFont font);
79JNIEXPORT unsigned JNICALL AWTFontMinCharOrByte2(AWTFont font);
80JNIEXPORT unsigned JNICALL AWTFontMaxCharOrByte2(AWTFont font);
81JNIEXPORT unsigned JNICALL AWTFontDefaultChar(AWTFont font);
82/* Do not call AWTFreeChar() after AWTFontPerChar() or AWTFontMaxBounds() */
83JNIEXPORT AWTChar JNICALL AWTFontPerChar(AWTFont font, int index);
84JNIEXPORT AWTChar JNICALL AWTFontMaxBounds(AWTFont font);
85JNIEXPORT int JNICALL AWTFontAscent(AWTFont font);
86JNIEXPORT int JNICALL AWTFontDescent(AWTFont font);
87/* Call AWTFreeChar() on overall after calling AWTFontQueryTextExtents16() */
88JNIEXPORT void JNICALL AWTFontTextExtents16(AWTFont font, AWTChar2b* xChar,
89 AWTChar* overall);
90JNIEXPORT void JNICALL AWTFreeChar(AWTChar xChar);
91JNIEXPORT jlong JNICALL AWTFontGenerateImage(AWTFont xFont, AWTChar2b* xChar);
92JNIEXPORT short JNICALL AWTCharAdvance(AWTChar xChar);
93JNIEXPORT short JNICALL AWTCharLBearing(AWTChar xChar);
94JNIEXPORT short JNICALL AWTCharRBearing(AWTChar xChar);
95JNIEXPORT short JNICALL AWTCharAscent(AWTChar xChar);
96JNIEXPORT short JNICALL AWTCharDescent(AWTChar xChar);
97
98#endif
99