static jobject getGlyphGeneralPath(JNIEnv* env, jobject font2D, FTScalerContext *context, FTScalerInfo *scalerInfo, jint glyphCode, jfloat xpos, jfloat ypos) { FT_Outline* outline; jobject gp = NULL; jbyteArray types; jfloatArray coords; GPData gpdata; outline = getFTOutline(env, font2D, context, scalerInfo, glyphCode, xpos, ypos); if (outline == NULL || outline->n_points == 0) { return gp; } gpdata.pointTypes = NULL; gpdata.pointCoords = NULL; if (!allocateSpaceForGP(&gpdata, outline->n_points, outline->n_contours)) { return gp; } addToGP(&gpdata, outline); types = (*env)->NewByteArray(env, gpdata.numTypes); coords = (*env)->NewFloatArray(env, gpdata.numCoords); if (types && coords) { (*env)->SetByteArrayRegion(env, types, 0, gpdata.numTypes, gpdata.pointTypes); (*env)->SetFloatArrayRegion(env, coords, 0, gpdata.numCoords, gpdata.pointCoords); gp = (*env)->NewObject(env, sunFontIDs.gpClass, sunFontIDs.gpCtr, gpdata.wr, types, gpdata.numTypes, coords, gpdata.numCoords); } freeGP(&gpdata); return gp; }
void GravityPointManager::freeAllGPs() { for (GravityPoint & gp : gravityPoints) freeGP(gp); }