/* * Class: org_libharu_PdfPage * Method: setHorizontalScaling * Signature: (F)V */ JNIEXPORT void JNICALL Java_org_libharu_PdfPage_setHorizontalScaling(JNIEnv *env, jobject obj, jfloat value) { jint page; /* Get mHPDFPagePointer */ page = (*env)->GetIntField(env, obj, mHPDFPagePointer); HPDF_Page_SetHorizontalScalling((HPDF_Page) page, (HPDF_REAL) value); }
void hpdf_doc::set_font_handle(HPDF_Page h_page, HPDF_Font h_font, bool isCJK) { if (h_font != 0) // seccessfully get font { int n_TX = (et_cp.TX > 0) ? et_cp.TX : et_cp.T, n_TY = (et_cp.TY > 0) ? et_cp.TY : et_cp.T; HPDF_REAL font_height = MMTEXT2PTX(et_cp.Z * n_TY); HPDF_REAL font_width = MMTEXT2PTX(et_cp.W * n_TX / 2); HPDF_REAL ratio = 100.0; /* if (font_width >= font_height) { ratio = (HPDF_REAL) (100.0 * font_width / font_height); } */ if (isCJK) ratio = (HPDF_REAL)((200.0 * font_width) / font_height); else ratio = 100.0; HPDF_Page_SetFontAndSize(h_page, h_font, font_height); HPDF_Page_SetHorizontalScalling(h_page, ratio); f_font_height = font_height; f_font_width = font_width; } }
void hpdf_doc::resize_font_boxdraw() { if (h_current_font != 0) // seccessfully get font { int n_TX = (et_cp.TX > 0) ? et_cp.TX : et_cp.T, n_TY = (et_cp.TY > 0) ? et_cp.TY : et_cp.T; HPDF_REAL font_height = MMTEXT2PTX((et_cp.Z * n_TY) + et_cp.L); HPDF_REAL font_width = MMTEXT2PTX((et_cp.W * n_TX / 2) + (et_cp.X/2)); HPDF_REAL ratio = 100.0; ratio = (HPDF_REAL) ((double)(200.0 * font_width) / font_height); HPDF_Page_SetFontAndSize(h_current_page, h_current_font, font_height); HPDF_Page_SetHorizontalScalling(h_current_page, ratio); } }