summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-49.1/layout/loengine.cpp
blob: 3718b9f6f8a4955873d69b6d660d09810f4e7060 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
 *
 * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
 *
 */

#include "LETypes.h"
#include "loengine.h"
#include "LayoutEngine.h"

/**
 * \file 
 * \brief C API for complex text layout.
 */

U_NAMESPACE_USE

U_CAPI le_engine * U_EXPORT2
le_create(const le_font *font,
		  le_int32 scriptCode,
		  le_int32 languageCode,
		  le_int32 typo_flags,
		  LEErrorCode *success)
{
	LEFontInstance *fontInstance = (LEFontInstance *) font;

	return (le_engine *) LayoutEngine::layoutEngineFactory(fontInstance, scriptCode, languageCode, typo_flags, *success);
}

U_CAPI void U_EXPORT2
le_close(le_engine *engine)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	delete le;
}

U_CAPI le_int32 U_EXPORT2
le_layoutChars(le_engine *engine,
			   const LEUnicode chars[],
			   le_int32 offset,
			   le_int32 count,
			   le_int32 max,
			   le_bool rightToLeft,
			   float x,
			   float y,
			   LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return -1;
	}

	return le->layoutChars(chars, offset, count, max, rightToLeft, x, y, *success);
}

U_CAPI le_int32 U_EXPORT2
le_getGlyphCount(le_engine *engine,
				 LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return -1;
	}

	return le->getGlyphCount();
}

U_CAPI void U_EXPORT2
le_getGlyphs(le_engine *engine,
			 LEGlyphID glyphs[],
			 LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return;
	}

	le->getGlyphs(glyphs, *success);
}

U_CAPI void U_EXPORT2
le_getCharIndices(le_engine *engine,
				  le_int32 charIndices[],
				  LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return;
	}

	le->getCharIndices(charIndices, *success);
}

U_CAPI void U_EXPORT2
le_getCharIndicesWithBase(le_engine *engine,
				          le_int32 charIndices[],
				          le_int32 indexBase,
				          LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return;
	}

	le->getCharIndices(charIndices, indexBase, *success);
}

U_CAPI void U_EXPORT2
le_getGlyphPositions(le_engine *engine,
					 float positions[],
					 LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return;
	}

	le->getGlyphPositions(positions, *success);
}

U_CAPI void U_EXPORT2
le_getGlyphPosition(le_engine *engine,
					le_int32 glyphIndex,
					float *x,
					float *y,
					LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return;
	}

	le->getGlyphPosition(glyphIndex, *x, *y, *success);
}

U_CAPI void U_EXPORT2
le_reset(le_engine *engine,
		 LEErrorCode *success)
{
	LayoutEngine *le = (LayoutEngine *) engine;

	if (le == NULL) {
		*success = LE_ILLEGAL_ARGUMENT_ERROR;
		return;
	}

	le->reset();
}