diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-01-21 23:46:58 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-01-21 23:46:58 +0000 |
commit | 21aafcb365a902c90415b483ba77c4b95a80cac9 (patch) | |
tree | 4bf14147c6c83b8fdfb020b96a36eb91741da11c /Build/source/texk/web2c | |
parent | c826689e35799045873cee4c33d95d7820317ec8 (diff) |
web2c/luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@39454 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/writet3.w | 71 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/pdf/pdfgen.w | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/pdf/pdftables.h | 2 |
3 files changed, 32 insertions, 43 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/writet3.w b/Build/source/texk/web2c/luatexdir/font/writet3.w index 36a5e376d9c..005d2795fc3 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet3.w +++ b/Build/source/texk/web2c/luatexdir/font/writet3.w @@ -46,14 +46,13 @@ unsigned char *t3_buffer = NULL; int t3_size = 0; int t3_curbyte = 0; -#define t3_check_eof() \ - if (t3_eof()) \ +#define t3_check_eof() \ + if (t3_eof()) \ normal_error("type 3","unexpected end of file"); @ @c -static void update_bbox(int llx, int lly, int urx, int ury, - boolean is_first_glyph) +static void update_bbox(int llx, int lly, int urx, int ury, boolean is_first_glyph) { if (is_first_glyph) { t3_b0 = llx; @@ -72,22 +71,13 @@ static void update_bbox(int llx, int lly, int urx, int ury, } } -static int get_pk_font_scale(internal_font_number f, int precision, - int scale_factor) -{ - return - divide_scaled(scale_factor, - divide_scaled(font_size(f), one_hundred_bp, - precision + 2), 0); -} +/* fixed precision 3 (+5 in pdfgen.w)*/ -static int pk_char_width(internal_font_number f, scaled w, int precision, - int scale_factor) -{ - return - divide_scaled(divide_scaled(w, font_size(f), 7), - get_pk_font_scale(f, precision, scale_factor), 0); -} +#define get_pk_font_scale(pdf,f,scale_factor) \ + divide_scaled(scale_factor, divide_scaled(font_size(f),one_hundred_bp,pk_decimal_digits(pdf,2)), 0) + +#define pk_char_width(pdf,f,w,scale_factor) \ + divide_scaled(divide_scaled(w,font_size(f),pk_decimal_digits(pdf,4)), get_pk_font_scale(pdf,f,scale_factor), 0) @ @c @@ -112,8 +102,7 @@ static boolean writepk(PDF pdf, internal_font_number f) if (callback_id > 0) { /* <base>.dpi/<fontname>.<tdpi>pk */ - dpi = round((float) pdf->pk_resolution * - (((float) font_size(f)) / (float) font_dsize(f))); + dpi = round((float) pdf->pk_resolution * (((float) font_size(f)) / (float) font_dsize(f))); cur_file_name = font_name(f); run_callback(callback_id, "Sd->S", cur_file_name, (int) dpi, &name); if (name == NULL || strlen(name) == 0) { @@ -127,11 +116,10 @@ static boolean writepk(PDF pdf, internal_font_number f) ); cur_file_name = font_name(f); name = kpse_find_pk(cur_file_name, (unsigned) dpi, &font_ret); - if (name == NULL || - !FILESTRCASEEQ(cur_file_name, font_ret.name) || - !kpse_bitmap_tolerance((float) font_ret.dpi, (float) dpi)) { - formatted_error("type 3","font %s at %i not found", cur_file_name, (int) dpi); - return false; + if (name == NULL || !FILESTRCASEEQ(cur_file_name, font_ret.name) + || !kpse_bitmap_tolerance((float) font_ret.dpi, (float) dpi)) { + formatted_error("type 3","font %s at %i not found", cur_file_name, (int) dpi); + return false; } } callback_id = callback_defined(read_pk_file_callback); @@ -157,9 +145,7 @@ static boolean writepk(PDF pdf, internal_font_number f) check_preamble = false; if (!pdf_char_marked(f, cd.charcode)) continue; - t3_char_widths[cd.charcode] = (float) -/* pk_char_width(f, get_charwidth(f, cd.charcode), pdf->decimal_digits, pdf->pk_scale_factor);*/ - pk_char_width(f, get_charwidth(f, cd.charcode), 3, pdf->pk_scale_factor); + t3_char_widths[cd.charcode] = (float) pk_char_width(pdf, f, get_charwidth(f, cd.charcode), pdf->pk_scale_factor); if (cd.cwidth < 1 || cd.cheight < 1) { cd.xescape = cd.cwidth = round(t3_char_widths[cd.charcode] / 100.0); cd.cheight = 1; @@ -182,12 +168,10 @@ static boolean writepk(PDF pdf, internal_font_number f) pdf_begin_stream(pdf); setpdffloat(pf, (int64_t) t3_char_widths[cd.charcode], 2); print_pdffloat(pdf, pf); - pdf_printf(pdf, " 0 %i %i %i %i d1\n", - (int) llx, (int) lly, (int) urx, (int) ury); + pdf_printf(pdf, " 0 %i %i %i %i d1\n", (int) llx, (int) lly, (int) urx, (int) ury); if (is_null_glyph) goto end_stream; - pdf_printf(pdf, "q\n%i 0 0 %i %i %i cm\nBI\n", (int) cd.cwidth, - (int) cd.cheight, (int) llx, (int) lly); + pdf_printf(pdf, "q\n%i 0 0 %i %i %i cm\nBI\n", (int) cd.cwidth, (int) cd.cheight, (int) llx, (int) lly); pdf_printf(pdf, "/W %i\n/H %i\n", (int) cd.cwidth, (int) cd.cheight); pdf_puts(pdf, "/IM true\n/BPC 1\n/D [1 0]\nID "); cw = (cd.cwidth + 7) / 8; @@ -261,8 +245,7 @@ void writet3(PDF pdf, internal_font_number f) pdf_out(pdf, '\n'); } if (is_pk_font) { -/* pk_font_scale = get_pk_font_scale(f, pdf->decimal_digits, pdf->pk_scale_factor); */ - pk_font_scale = get_pk_font_scale(f, 3, pdf->pk_scale_factor); + pk_font_scale = get_pk_font_scale(pdf,f,pdf->pk_scale_factor); pdf_add_name(pdf, "FontMatrix"); pdf_begin_array(pdf); setpdffloat(pf, (int64_t) pk_font_scale, 5); @@ -274,8 +257,7 @@ void writet3(PDF pdf, internal_font_number f) } else { pdf_add_name(pdf, "FontMatrix"); pdf_begin_array(pdf); - pdf_printf(pdf, "%g 0 0 %g 0 0", - (double) t3_font_scale, (double) t3_font_scale); + pdf_printf(pdf, "%g 0 0 %g 0 0", (double) t3_font_scale, (double) t3_font_scale); pdf_end_array(pdf); } pdf_add_name(pdf, font_key[FONTBBOX1_CODE].pdfname); @@ -290,8 +272,9 @@ void writet3(PDF pdf, internal_font_number f) pdf_add_name(pdf, "ProcSet"); pdf_begin_array(pdf); pdf_add_name(pdf, "PDF"); - if (t3_image_used) + if (t3_image_used) { pdf_add_name(pdf, "ImageB"); + } pdf_end_array(pdf); pdf_end_dict(pdf); pdf_dict_add_int(pdf, "FirstChar", first_char); @@ -308,14 +291,17 @@ void writet3(PDF pdf, internal_font_number f) /* chars width array */ pdf_begin_obj(pdf, wptr, OBJSTM_ALWAYS); pdf_begin_array(pdf); - if (is_pk_font) + if (is_pk_font) { for (i = first_char; i <= last_char; i++) { setpdffloat(pf, (int64_t) t3_char_widths[i], 2); print_pdffloat(pdf, pf); pdf_out(pdf, ' '); - } else - for (i = first_char; i <= last_char; i++) + } + } else { + for (i = first_char; i <= last_char; i++) { pdf_add_int(pdf, (int) t3_char_widths[i]); + } + } pdf_end_array(pdf); pdf_end_obj(pdf); @@ -357,11 +343,12 @@ void writet3(PDF pdf, internal_font_number f) /* CharProcs dictionary */ pdf_begin_obj(pdf, cptr, OBJSTM_ALWAYS); pdf_begin_dict(pdf); - for (i = first_char; i <= last_char; i++) + for (i = first_char; i <= last_char; i++) { if (t3_char_procs[i] != 0) { snprintf(s, 31, "a%i", (int) i); pdf_dict_add_ref(pdf, s, (int) t3_char_procs[i]); } + } pdf_end_dict(pdf); pdf_end_obj(pdf); report_stop_file(filetype_font); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w index b5294954e6d..4606d2a2c91 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w @@ -932,7 +932,7 @@ static void init_pdf_outputparameters(PDF pdf) } if (pdf->pk_resolution == 0) /* if not set from format file or by user */ pdf->pk_resolution = pk_dpi; /* take it from \.{texmf.cnf} */ - pdf->pk_scale_factor = divide_scaled(72, pdf->pk_resolution, 3+5); /* (pdf->decimal_digits < 4 ? 8 : 9));*/ + pdf->pk_scale_factor = divide_scaled(72, pdf->pk_resolution, pk_decimal_digits(pdf,5)); if (!callback_defined(read_pk_file_callback)) { pk_mode = pdf_pk_mode; /* lookup once */ if (pk_mode != null) { diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h index badc6b2fd70..f42122ee644 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h @@ -192,4 +192,6 @@ extern int pdf_retval; # define set_pdf_decimal_digits(i) set_tex_extension_count_register(c_pdf_decimal_digits,i) +# define pk_decimal_digits(pdf,delta) ((pdf->decimal_digits > 4 ? 4 : 3) + delta) + #endif |