134 * Method: nativeLayout
135 * Signature: (Lsun/font/FontStrike;[CIIIIZLjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;)V
136 */
137 JNIEXPORT void JNICALL Java_sun_font_SunLayoutEngine_nativeLayout
138 (JNIEnv *env, jclass cls, jobject font2d, jobject strike, jfloatArray matrix, jint gmask,
139 jint baseIndex, jcharArray text, jint start, jint limit, jint min, jint max,
140 jint script, jint lang, jint typo_flags, jobject pt, jobject gvdata,
141 jlong upem, jlong layoutTables)
142 {
143 // fprintf(stderr, "nl font: %x strike: %x script: %d\n", font2d, strike, script); fflush(stderr);
144 float mat[4];
145 env->GetFloatArrayRegion(matrix, 0, 4, mat);
146 FontInstanceAdapter fia(env, font2d, strike, mat, 72, 72, (le_int32) upem, (TTLayoutTableCache *) layoutTables);
147 LEErrorCode success = LE_NO_ERROR;
148 LayoutEngine *engine = LayoutEngine::layoutEngineFactory(&fia, script, lang, typo_flags & TYPO_MASK, success);
149 if (engine == NULL) {
150 env->SetIntField(gvdata, gvdCountFID, -1); // flag failure
151 return;
152 }
153
154 if (min < 0) min = 0; if (max < min) max = min; /* defensive coding */
155 // have to copy, yuck, since code does upcalls now. this will be soooo slow
156 jint len = max - min;
157 jchar buffer[256];
158 jchar* chars = buffer;
159 if (len > 256) {
160 size_t size = len * sizeof(jchar);
161 if (size / sizeof(jchar) != (size_t)len) {
162 return;
163 }
164 chars = (jchar*)malloc(size);
165 if (chars == 0) {
166 return;
167 }
168 }
169 // fprintf(stderr, "nl chars: %x text: %x min %d len %d typo %x\n", chars, text, min, len, typo_flags); fflush(stderr);
170
171 env->GetCharArrayRegion(text, min, len, chars);
172
173 jfloat x, y;
174 getFloat(env, pt, x, y);
|
134 * Method: nativeLayout
135 * Signature: (Lsun/font/FontStrike;[CIIIIZLjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;)V
136 */
137 JNIEXPORT void JNICALL Java_sun_font_SunLayoutEngine_nativeLayout
138 (JNIEnv *env, jclass cls, jobject font2d, jobject strike, jfloatArray matrix, jint gmask,
139 jint baseIndex, jcharArray text, jint start, jint limit, jint min, jint max,
140 jint script, jint lang, jint typo_flags, jobject pt, jobject gvdata,
141 jlong upem, jlong layoutTables)
142 {
143 // fprintf(stderr, "nl font: %x strike: %x script: %d\n", font2d, strike, script); fflush(stderr);
144 float mat[4];
145 env->GetFloatArrayRegion(matrix, 0, 4, mat);
146 FontInstanceAdapter fia(env, font2d, strike, mat, 72, 72, (le_int32) upem, (TTLayoutTableCache *) layoutTables);
147 LEErrorCode success = LE_NO_ERROR;
148 LayoutEngine *engine = LayoutEngine::layoutEngineFactory(&fia, script, lang, typo_flags & TYPO_MASK, success);
149 if (engine == NULL) {
150 env->SetIntField(gvdata, gvdCountFID, -1); // flag failure
151 return;
152 }
153
154 if (min < 0) min = 0;
155 if (max < min) max = min; /* defensive coding */
156 // have to copy, yuck, since code does upcalls now. this will be soooo slow
157 jint len = max - min;
158 jchar buffer[256];
159 jchar* chars = buffer;
160 if (len > 256) {
161 size_t size = len * sizeof(jchar);
162 if (size / sizeof(jchar) != (size_t)len) {
163 return;
164 }
165 chars = (jchar*)malloc(size);
166 if (chars == 0) {
167 return;
168 }
169 }
170 // fprintf(stderr, "nl chars: %x text: %x min %d len %d typo %x\n", chars, text, min, len, typo_flags); fflush(stderr);
171
172 env->GetCharArrayRegion(text, min, len, chars);
173
174 jfloat x, y;
175 getFloat(env, pt, x, y);
|